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()
This commit is contained in:
1
diff.c
1
diff.c
@ -3675,6 +3675,7 @@ static void builtin_diff(const char *name_a,
|
|||||||
emit_diff_symbol(o, DIFF_SYMBOL_BINARY_FILES,
|
emit_diff_symbol(o, DIFF_SYMBOL_BINARY_FILES,
|
||||||
sb.buf, sb.len, 0);
|
sb.buf, sb.len, 0);
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
|
o->found_changes = 1;
|
||||||
goto free_ab_and_return;
|
goto free_ab_and_return;
|
||||||
}
|
}
|
||||||
if (fill_mmfile(o->repo, &mf1, one) < 0 ||
|
if (fill_mmfile(o->repo, &mf1, one) < 0 ||
|
||||||
|
@ -145,6 +145,14 @@ test_expect_success 'option errors are not confused by --exit-code' '
|
|||||||
|
|
||||||
for option in --exit-code --quiet
|
for option in --exit-code --quiet
|
||||||
do
|
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" "
|
test_expect_success "git diff $option returns 1 for copied file" "
|
||||||
git reset --hard &&
|
git reset --hard &&
|
||||||
cp a copy &&
|
cp a copy &&
|
||||||
|
Reference in New Issue
Block a user