Browse Source

diff: --color-moved: rename "dimmed_zebra" to "dimmed-zebra"

The --color-moved "dimmed_zebra" mode (with an underscore) is an
anachronism. Most options and modes are hyphenated. It is more difficult
to type and somewhat more difficult to read than those which are
hyphenated. Therefore, rename it to "dimmed-zebra", and nominally
deprecate "dimmed_zebra".

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Eric Sunshine 7 years ago committed by Junio C Hamano
parent
commit
e3f2f5f9cd
  1. 3
      Documentation/diff-options.txt
  2. 4
      diff.c
  3. 4
      t/t4015-diff-whitespace.sh

3
Documentation/diff-options.txt

@ -274,10 +274,11 @@ zebra::
painted using either the 'color.diff.{old,new}Moved' color or 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.
-- --


--word-diff[=<mode>]:: --word-diff[=<mode>]::

4
diff.c

@ -275,10 +275,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', 'zebra', 'dimmed_zebra', 'plain'")); return error(_("color moved setting must be one of 'no', 'default', 'zebra', 'dimmed-zebra', 'plain'"));
} }


int git_diff_ui_config(const char *var, const char *value, void *cb) int git_diff_ui_config(const char *var, const char *value, void *cb)

4
t/t4015-diff-whitespace.sh

@ -1223,7 +1223,7 @@ test_expect_success 'plain moved code, inside file' '
test_cmp expected actual test_cmp expected actual
' '


test_expect_success 'detect permutations inside moved code -- dimmed_zebra' ' test_expect_success 'detect permutations inside moved code -- dimmed-zebra' '
git reset --hard && git reset --hard &&
cat <<-\EOF >lines.txt && cat <<-\EOF >lines.txt &&
long line 1 long line 1
@ -1271,7 +1271,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 | git diff HEAD --no-renames --color-moved=dimmed-zebra --color |
grep -v "index" | grep -v "index" |
test_decode_color >actual && test_decode_color >actual &&
cat <<-\EOF >expected && cat <<-\EOF >expected &&

Loading…
Cancel
Save