diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2021-12-09 10:29:59 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-09 13:24:05 -0800 |
commit | eb315457f65e1d6b77cde3933b6a175e649fb34b (patch) | |
tree | dfaff824bdeb5192ca86e47f217bf699b0aedd2f /mergetools/bc | |
parent | diff --color-moved: rewind when discarding pmb (diff) | |
download | tgif-eb315457f65e1d6b77cde3933b6a175e649fb34b.tar.xz |
diff --color-moved=zebra: fix alternate coloring
b0a2ba4776 ("diff --color-moved=zebra: be stricter with color
alternation", 2018-11-23) sought to avoid using the alternate colors
unless there are two adjacent moved blocks of the same
sign. Unfortunately it contains two bugs that prevented it from fixing
the problem properly. Firstly `last_symbol` is reset at the start of
each iteration of the loop losing the symbol of the last line and
secondly when deciding whether to use the alternate color it should be
checking if the current line is the same sign of the last line, not a
different sign. The combination of the two errors means that we still
use the alternate color when we should do but we also use it when we
shouldn't. This is most noticable when using
--color-moved-ws=allow-indentation-change with hunks like
-this line gets indented
+ this line gets indented
where the post image is colored with newMovedAlternate rather than
newMoved. While this does not matter much, the next commit will change
the coloring to be correct in this case, so lets fix the bug here to
make it clear why the output is changing and add a regression test.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mergetools/bc')
0 files changed, 0 insertions, 0 deletions