diff: allow --no-color-moved-ws
Allow --no-color-moved-ws and --color-moved-ws=no to cancel any previous --color-moved-ws option. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
748aa1aa34
commit
b73bcbac4a
|
@ -306,6 +306,8 @@ endif::git-diff[]
|
||||||
These modes can be given as a comma separated list:
|
These modes can be given as a comma separated list:
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
|
no::
|
||||||
|
Do not ignore whitespace when performing move detection.
|
||||||
ignore-space-at-eol::
|
ignore-space-at-eol::
|
||||||
Ignore changes in whitespace at EOL.
|
Ignore changes in whitespace at EOL.
|
||||||
ignore-space-change::
|
ignore-space-change::
|
||||||
|
@ -322,6 +324,11 @@ allow-indentation-change::
|
||||||
other modes.
|
other modes.
|
||||||
--
|
--
|
||||||
|
|
||||||
|
--no-color-moved-ws::
|
||||||
|
Do not ignore whitespace when performing move detection. This can be
|
||||||
|
used to override configuration settings. It is the same as
|
||||||
|
`--color-moved-ws=no`.
|
||||||
|
|
||||||
--word-diff[=<mode>]::
|
--word-diff[=<mode>]::
|
||||||
Show a word diff, using the <mode> to delimit changed words.
|
Show a word diff, using the <mode> to delimit changed words.
|
||||||
By default, words are delimited by whitespace; see
|
By default, words are delimited by whitespace; see
|
||||||
|
|
6
diff.c
6
diff.c
|
@ -304,7 +304,9 @@ static int parse_color_moved_ws(const char *arg)
|
||||||
strbuf_addstr(&sb, i->string);
|
strbuf_addstr(&sb, i->string);
|
||||||
strbuf_trim(&sb);
|
strbuf_trim(&sb);
|
||||||
|
|
||||||
if (!strcmp(sb.buf, "ignore-space-change"))
|
if (!strcmp(sb.buf, "no"))
|
||||||
|
ret = 0;
|
||||||
|
else if (!strcmp(sb.buf, "ignore-space-change"))
|
||||||
ret |= XDF_IGNORE_WHITESPACE_CHANGE;
|
ret |= XDF_IGNORE_WHITESPACE_CHANGE;
|
||||||
else if (!strcmp(sb.buf, "ignore-space-at-eol"))
|
else if (!strcmp(sb.buf, "ignore-space-at-eol"))
|
||||||
ret |= XDF_IGNORE_WHITESPACE_AT_EOL;
|
ret |= XDF_IGNORE_WHITESPACE_AT_EOL;
|
||||||
|
@ -5036,6 +5038,8 @@ int diff_opt_parse(struct diff_options *options,
|
||||||
if (cm < 0)
|
if (cm < 0)
|
||||||
die("bad --color-moved argument: %s", arg);
|
die("bad --color-moved argument: %s", arg);
|
||||||
options->color_moved = cm;
|
options->color_moved = cm;
|
||||||
|
} else if (!strcmp(arg, "--no-color-moved-ws")) {
|
||||||
|
options->color_moved_ws_handling = 0;
|
||||||
} else if (skip_prefix(arg, "--color-moved-ws=", &arg)) {
|
} else if (skip_prefix(arg, "--color-moved-ws=", &arg)) {
|
||||||
options->color_moved_ws_handling = parse_color_moved_ws(arg);
|
options->color_moved_ws_handling = parse_color_moved_ws(arg);
|
||||||
} else if (skip_to_optional_arg_default(arg, "--color-words", &options->word_regex, NULL)) {
|
} else if (skip_to_optional_arg_default(arg, "--color-words", &options->word_regex, NULL)) {
|
||||||
|
|
Loading…
Reference in New Issue