diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-09-25 18:24:51 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-25 18:24:52 -0700 |
| commit | f92c61aef0190641e01294dad3b891b28113e1d5 (patch) | |
| tree | 9654a55d7427cf8e609c446336165818aa5be75c | |
| parent | cd845c04224f203f614618a72843f24645accda3 (diff) | |
| parent | 9a41735af66dba1b677a8e88e7c2bc2f831bf6d2 (diff) | |
| download | git-f92c61aef0190641e01294dad3b891b28113e1d5.tar.gz | |
Merge branch 'rs/diff-exit-code-binary'
"git diff --exit-code" ignored modified binary files, which has
been corrected.
* rs/diff-exit-code-binary:
diff: report modified binary files as changes in builtin_diff()
| -rw-r--r-- | diff.c | 1 | ||||
| -rwxr-xr-x | t/t4017-diff-retval.sh | 8 |
2 files changed, 9 insertions, 0 deletions
@@ -3675,6 +3675,7 @@ static void builtin_diff(const char *name_a, emit_diff_symbol(o, DIFF_SYMBOL_BINARY_FILES, sb.buf, sb.len, 0); strbuf_release(&sb); + o->found_changes = 1; goto free_ab_and_return; } if (fill_mmfile(o->repo, &mf1, one) < 0 || diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh index d644310e22..1cea73ef5a 100755 --- a/t/t4017-diff-retval.sh +++ b/t/t4017-diff-retval.sh @@ -145,6 +145,14 @@ test_expect_success 'option errors are not confused by --exit-code' ' for option in --exit-code --quiet do + test_expect_success "git diff $option returns 1 for changed binary file" " + test_when_finished 'rm -f .gitattributes' && + git reset --hard && + echo a binary >.gitattributes && + echo 2 >>a && + test_expect_code 1 git diff $option + " + test_expect_success "git diff $option returns 1 for copied file" " git reset --hard && cp a copy && |
