summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-10-04 22:26:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-10-04 22:49:05 (GMT)
commita17505f262b62e429bb0e188c5ed73ac749e25b8 (patch)
treef50696174df4b24ce70883b4d89b301edb10215e /diff.c
parent0b4b42e7fe1b507fb387c18d9a2748768359bf5d (diff)
downloadgit-a17505f262b62e429bb0e188c5ed73ac749e25b8.zip
git-a17505f262b62e429bb0e188c5ed73ac749e25b8.tar.gz
git-a17505f262b62e429bb0e188c5ed73ac749e25b8.tar.bz2
diff: introduce diff.wsErrorHighlight option
With the preparatory steps, it has become trivial to teach the system a new diff.wsErrorHighlight configuration that gives the default value for --ws-error-highlight command line option. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/diff.c b/diff.c
index bd625cf..9acf04f 100644
--- a/diff.c
+++ b/diff.c
@@ -41,6 +41,7 @@ static int diff_stat_graph_width;
static int diff_dirstat_permille_default = 30;
static struct diff_options default_diff_options;
static long diff_algorithm;
+static unsigned ws_error_highlight_default = WSEH_NEW;
static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_RESET,
@@ -262,6 +263,14 @@ 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;
@@ -3306,7 +3315,7 @@ void diff_setup(struct diff_options *options)
options->rename_limit = -1;
options->dirstat_permille = diff_dirstat_permille_default;
options->context = diff_context_default;
- options->ws_error_highlight = WSEH_NEW;
+ options->ws_error_highlight = ws_error_highlight_default;
DIFF_OPT_SET(options, RENAME_EMPTY);
/* pathchange left =NULL by default */