Merge branch 'es/diff-color-moved-fix'

One of the "diff --color-moved" mode "dimmed_zebra" that was named
in an unusual way has been deprecated and replaced by
"dimmed-zebra".

* es/diff-color-moved-fix:
  diff: --color-moved: rename "dimmed_zebra" to "dimmed-zebra"
This commit is contained in:
Junio C Hamano 2018-08-15 15:08:22 -07:00
commit 706b0b5e8d
3 changed files with 7 additions and 4 deletions

View File

@ -286,10 +286,11 @@ zebra::
are painted using either the 'color.diff.{old,new}Moved' color or are painted using either the 'color.diff.{old,new}Moved' color or
'color.diff.{old,new}MovedAlternative'. The change between 'color.diff.{old,new}MovedAlternative'. The change between
the two colors indicates that a new block was detected. the two colors indicates that a new block was detected.
dimmed_zebra:: dimmed-zebra::
Similar to 'zebra', but additional dimming of uninteresting parts Similar to 'zebra', but additional dimming of uninteresting parts
of moved code is performed. The bordering lines of two adjacent of moved code is performed. The bordering lines of two adjacent
blocks are considered interesting, the rest is uninteresting. blocks are considered interesting, the rest is uninteresting.
`dimmed_zebra` is a deprecated synonym.
-- --
--color-moved-ws=<modes>:: --color-moved-ws=<modes>::

4
diff.c
View File

@ -271,10 +271,12 @@ static int parse_color_moved(const char *arg)
return COLOR_MOVED_ZEBRA; return COLOR_MOVED_ZEBRA;
else if (!strcmp(arg, "default")) else if (!strcmp(arg, "default"))
return COLOR_MOVED_DEFAULT; return COLOR_MOVED_DEFAULT;
else if (!strcmp(arg, "dimmed-zebra"))
return COLOR_MOVED_ZEBRA_DIM;
else if (!strcmp(arg, "dimmed_zebra")) else if (!strcmp(arg, "dimmed_zebra"))
return COLOR_MOVED_ZEBRA_DIM; return COLOR_MOVED_ZEBRA_DIM;
else else
return error(_("color moved setting must be one of 'no', 'default', 'blocks', 'zebra', 'dimmed_zebra', 'plain'")); return error(_("color moved setting must be one of 'no', 'default', 'blocks', 'zebra', 'dimmed-zebra', 'plain'"));
} }
static int parse_color_moved_ws(const char *arg) static int parse_color_moved_ws(const char *arg)

View File

@ -1305,7 +1305,7 @@ test_expect_success 'detect blocks of moved code' '
' '
test_expect_success 'detect permutations inside moved code -- dimmed_zebra' ' test_expect_success 'detect permutations inside moved code -- dimmed-zebra' '
# reuse setup from test before! # reuse setup from test before!
test_config color.diff.oldMoved "magenta" && test_config color.diff.oldMoved "magenta" &&
test_config color.diff.newMoved "cyan" && test_config color.diff.newMoved "cyan" &&
@ -1315,7 +1315,7 @@ test_expect_success 'detect permutations inside moved code -- dimmed_zebra' '
test_config color.diff.newMovedDimmed "normal cyan" && test_config color.diff.newMovedDimmed "normal cyan" &&
test_config color.diff.oldMovedAlternativeDimmed "normal blue" && test_config color.diff.oldMovedAlternativeDimmed "normal blue" &&
test_config color.diff.newMovedAlternativeDimmed "normal yellow" && test_config color.diff.newMovedAlternativeDimmed "normal yellow" &&
git diff HEAD --no-renames --color-moved=dimmed_zebra --color >actual.raw && git diff HEAD --no-renames --color-moved=dimmed-zebra --color >actual.raw &&
grep -v "index" actual.raw | test_decode_color >actual && grep -v "index" actual.raw | test_decode_color >actual &&
cat <<-\EOF >expected && cat <<-\EOF >expected &&
<BOLD>diff --git a/lines.txt b/lines.txt<RESET> <BOLD>diff --git a/lines.txt b/lines.txt<RESET>