]> git.ipfire.org Git - thirdparty/git.git/commitdiff
range-diff --dual-color: skip white-space warnings
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 13 Aug 2018 11:33:24 +0000 (04:33 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 13 Aug 2018 17:44:51 +0000 (10:44 -0700)
When displaying a diff of diffs, it is possible that there is an outer
`+` before a context line. That happens when the context changed between
old and new commit. When that context line starts with a tab (after the
space that marks it as context line), our diff machinery spits out a
white-space error (space before tab), but in this case, that is
incorrect.

Rather than adding a specific whitespace flag that specifically ignores
the first space in the output (and might miss other problems with the
white-space warnings), let's just skip handling white-space errors in
dual color mode to begin with.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c

diff --git a/diff.c b/diff.c
index e6c857abf4e12eb5d05f537dc8f4fb2675a82d59..ea8ecae0417b76645a706ae21297bf6a134ea3c9 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1299,6 +1299,7 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
                                set = diff_get_color_opt(o, DIFF_FRAGINFO);
                        else if (c != '+')
                                set = diff_get_color_opt(o, DIFF_CONTEXT);
+                       flags &= ~DIFF_SYMBOL_CONTENT_WS_MASK;
                }
                emit_line_ws_markup(o, set, reset, line, len, set_sign, '+',
                                    flags & DIFF_SYMBOL_CONTENT_WS_MASK,