1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 12:56:12 +02:00

range-diff: right-trim commit messages

When comparing commit messages, we need to keep in mind that they are
indented by four spaces. That is, empty lines are no longer empty, but
have "trailing whitespace". When displaying them in color, that results
in those nagging red lines.

Let's just right-trim the lines in the commit message, it's not like
trailing white-space in the commit messages are important enough to care
about in `git range-diff`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2018-08-13 04:33:08 -07:00 committed by Junio C Hamano
parent c8c5e43ac3
commit a142f978e7

View File

@ -85,6 +85,7 @@ static int read_patches(const char *range, struct string_list *list)
strbuf_addbuf(&buf, &line);
strbuf_addstr(&buf, "\n\n");
} else if (starts_with(line.buf, " ")) {
strbuf_rtrim(&line);
strbuf_addbuf(&buf, &line);
strbuf_addch(&buf, '\n');
}