Skip to content

Commit 2d97b4e

Browse files
committed
Merge branch 'rs/diff-color-moved-w-no-ext-diff-fix'
"git diff --no-ext-diff" when diff.external is configured ignored the "--color-moved" option. * rs/diff-color-moved-w-no-ext-diff-fix: diff: allow --color-moved with --no-ext-diff
2 parents ca349c3 + 0f4b0d4 commit 2d97b4e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

diff.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -4968,7 +4968,8 @@ void diff_setup_done(struct diff_options *options)
49684968
if (options->flags.follow_renames)
49694969
diff_check_follow_pathspec(&options->pathspec, 1);
49704970

4971-
if (!options->use_color || external_diff())
4971+
if (!options->use_color ||
4972+
(options->flags.allow_external && external_diff()))
49724973
options->color_moved = 0;
49734974

49744975
if (options->filter_not) {

t/t4015-diff-whitespace.sh

+9
Original file line numberDiff line numberDiff line change
@@ -1184,6 +1184,15 @@ test_expect_success 'detect moved code, complete file' '
11841184
test_cmp expected actual
11851185
'
11861186

1187+
test_expect_success '--color-moved with --no-ext-diff' '
1188+
test_config color.diff.oldMoved "yellow" &&
1189+
test_config color.diff.newMoved "blue" &&
1190+
args="--color --color-moved=zebra --no-renames HEAD" &&
1191+
git diff $args >expect &&
1192+
git -c diff.external=echo diff --no-ext-diff $args >actual &&
1193+
test_cmp expect actual
1194+
'
1195+
11871196
test_expect_success 'detect malicious moved code, inside file' '
11881197
test_config color.diff.oldMoved "normal red" &&
11891198
test_config color.diff.newMoved "normal green" &&

0 commit comments

Comments
 (0)