From: Junio C Hamano Date: Tue, 29 Jan 2019 20:47:53 +0000 (-0800) Subject: Merge branch 'pw/diff-color-moved-ws-fix' X-Git-Tag: v2.21.0-rc0~70 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/15b07cba0b60f0fc5dea0be0d68a355a8161476d Merge branch 'pw/diff-color-moved-ws-fix' "git diff --color-moved-ws" updates. * pw/diff-color-moved-ws-fix: diff --color-moved-ws: handle blank lines diff --color-moved-ws: modify allow-indentation-change diff --color-moved-ws: optimize allow-indentation-change diff --color-moved=zebra: be stricter with color alternation diff --color-moved-ws: fix false positives diff --color-moved-ws: demonstrate false positives diff: allow --no-color-moved-ws Use "whitespace" consistently diff: document --no-color-moved --- 15b07cba0b60f0fc5dea0be0d68a355a8161476d diff --cc diff.c index b96b7a4fc6,03ffe467e4..084bf54293 --- a/diff.c +++ b/diff.c @@@ -321,10 -321,8 +323,10 @@@ static unsigned parse_color_moved_ws(co } if ((ret & COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE) && - (ret & XDF_WHITESPACE_FLAGS)) - die(_("color-moved-ws: allow-indentation-change cannot be combined with other whitespace modes")); + (ret & XDF_WHITESPACE_FLAGS)) { - error(_("color-moved-ws: allow-indentation-change cannot be combined with other white space modes")); ++ error(_("color-moved-ws: allow-indentation-change cannot be combined with other whitespace modes")); + ret |= COLOR_MOVED_WS_ERROR; + } string_list_clear(&l, 0); @@@ -5040,13 -5097,12 +5103,15 @@@ int diff_opt_parse(struct diff_options else if (skip_prefix(arg, "--color-moved=", &arg)) { int cm = parse_color_moved(arg); if (cm < 0) - die("bad --color-moved argument: %s", arg); + return error("bad --color-moved argument: %s", arg); 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)) { - options->color_moved_ws_handling = parse_color_moved_ws(arg); + unsigned cm = parse_color_moved_ws(arg); + if (cm & COLOR_MOVED_WS_ERROR) + return -1; + options->color_moved_ws_handling = cm; } else if (skip_to_optional_arg_default(arg, "--color-words", &options->word_regex, NULL)) { options->use_color = 1; options->word_diff = DIFF_WORDS_COLOR;