Merge branch 'pw/diff-color-moved-ws-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 29 Jan 2019 20:47:53 +0000 (12:47 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Jan 2019 20:47:53 +0000 (12:47 -0800)
"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

1  2 
Documentation/diff-options.txt
diff.c
t/t4015-diff-whitespace.sh
Simple merge
diff --cc diff.c
index b96b7a4fc61fcdd63dee0a890eb3b40be5d0414b,03ffe467e474cf4ecef31cacb3f81a0ba8160fae..084bf542931e09c03a7627740f9177e5c9fac5d9
--- 1/diff.c
--- 2/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;
Simple merge