aboutsummaryrefslogtreecommitdiffstats
path: root/diff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2020-01-31 04:57:49 -0500
committerJunio C Hamano <gitster@pobox.com>2020-01-31 12:01:19 -0800
commitda8063522f7f797cf722f28979aefbe2a508f800 (patch)
tree7cb9726eb34814676724a7cdde5505e9efdc786f /diff.c
parentd0654dc308b0ba76dd8ed7bbb33c8d8f7aacd783 (diff)
downloadgit-da8063522f7f797cf722f28979aefbe2a508f800.tar.gz
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 'diff.c')
-rw-r--r--diff.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/diff.c b/diff.c
index 8e2914c031..5e4471f15f 100644
--- a/diff.c
+++ b/diff.c
@@ -414,14 +414,6 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
return 0;
}
- if (!strcmp(var, "diff.wserrorhighlight")) {
- int val = parse_ws_error_highlight(value);
- if (val < 0)
- return -1;
- ws_error_highlight_default = val;
- return 0;
- }
-
if (git_color_config(var, value, cb) < 0)
return -1;
@@ -450,6 +442,14 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
return color_parse(value, diff_colors[slot]);
}
+ if (!strcmp(var, "diff.wserrorhighlight")) {
+ int val = parse_ws_error_highlight(value);
+ if (val < 0)
+ return -1;
+ ws_error_highlight_default = val;
+ return 0;
+ }
+
/* like GNU diff's --suppress-blank-empty option */
if (!strcmp(var, "diff.suppressblankempty") ||
/* for backwards compatibility */