Re: diffstat summary mode change bug
To
Linus Torvalds
Cc
Stefan Beller
Git Mailing List
From
Junio C Hamano
See Also
Prev
Date
2017-09-28 04:12:23 UTC
Linus Torvalds <torvalds@linux-foundation.org> writes:

> and the reason seems to be that the '\n' at the end got dropped as the
> old code was very confusing (the old code had two different '\n' cases
> for the "show filename or not").
>
> I think the right fix is this whitespace-damaged trivial one-liner:
>
>   diff --git a/diff.c b/diff.c
>   index 3c6a3e0fa..653bb2e72 100644
>   --- a/diff.c
>   +++ b/diff.c
>   @@ -5272,6 +5272,7 @@ static void show_mode_change(struct
> diff_options *opt, struct diff_filepair *p,
>                           strbuf_addch(&sb, ' ');
>                           quote_c_style(p->two->path, &sb, NULL, 0);
>                   }
>   +               strbuf_addch(&sb, '\n');
>                   emit_diff_symbol(opt, DIFF_SYMBOL_SUMMARY,
>                                    sb.buf, sb.len, 0);
>                   strbuf_release(&sb);
>
> but somebody should double-check that.
>
>                         Linus

Thanks for being extra gentle by mentioning "old code was very
confusing", but it was not necessary.  We should have caught this
breakage during the review, but I somehow failed to spot it.  My
bad.

Thanks for a fix.