Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-01-31 12:57:49 +0300
committerJunio C Hamano <gitster@pobox.com>2020-01-31 23:01:19 +0300
commitda8063522f7f797cf722f28979aefbe2a508f800 (patch)
tree7cb9726eb34814676724a7cdde5505e9efdc786f /t/t3701-add-interactive.sh
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
diff: move diff.wsErrorHighlight to "basic" config
We parse diff.wsErrorHighlight in git_diff_ui_config(), meaning that it doesn't take effect for plumbing commands, only for porcelains like git-diff itself. This is mildly annoying as it means scripts like add--interactive, which produce a user-visible diff with color, don't respect the option. We could teach that script to parse the config and pass it along as --ws-error-highlight to the diff plumbing. But there's a simpler solution. It should be reasonably safe for plumbing to respect this option, as it only kicks in when color is otherwise enabled. And anybody parsing colorized output must already deal with the fact that color.diff.* may change the exact output they see; those options have been part of git_diff_basic_config() since its inception in 9a1805a872 (add a "basic" diff config callback, 2008-01-04). So we can just move it to the "basic" config, which fixes add--interactive, along with any other script in the same boat, with a very low risk of hurting any plumbing users. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 12ee321707..5337ccc671 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -544,6 +544,19 @@ test_expect_success 'diffs can be colorized' '
grep "$(printf "\\033")" output
'
+test_expect_success 'colorized diffs respect diff.wsErrorHighlight' '
+ git reset --hard &&
+
+ echo "old " >test &&
+ git add test &&
+ echo "new " >test &&
+
+ printf y >y &&
+ force_color git -c diff.wsErrorHighlight=all add -p >output.raw 2>&1 <y &&
+ test_decode_color <output.raw >output &&
+ grep "old<" output
+'
+
test_expect_success 'diffFilter filters diff' '
git reset --hard &&