Merge branch 'jk/diff-external-with-no-index' into maint-2.43
"git diff --no-index file1 file2" segfaulted while invoking the external diff driver, which has been corrected. * jk/diff-external-with-no-index: diff: handle NULL meta-info when spawning external diff
This commit is contained in:
1
diff.c
1
diff.c
@@ -4384,6 +4384,7 @@ static void run_external_diff(const char *pgm,
|
||||
add_external_diff_name(o->repo, &cmd.args, two);
|
||||
if (other) {
|
||||
strvec_push(&cmd.args, other);
|
||||
if (xfrm_msg)
|
||||
strvec_push(&cmd.args, xfrm_msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +205,18 @@ test_expect_success POSIXPERM,SYMLINKS 'diff --no-index normalizes: mode not lik
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
test_expect_success POSIXPERM 'external diff with mode-only change' '
|
||||
echo content >not-executable &&
|
||||
echo content >executable &&
|
||||
chmod +x executable &&
|
||||
echo executable executable $(test_oid zero) 100755 \
|
||||
not-executable $(test_oid zero) 100644 not-executable \
|
||||
>expect &&
|
||||
test_expect_code 1 git -c diff.external=echo diff \
|
||||
--no-index executable not-executable >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success "diff --no-index treats '-' as stdin" '
|
||||
cat >expect <<-EOF &&
|
||||
diff --git a/- b/a/1
|
||||
|
||||
Reference in New Issue
Block a user