Skip to content

Commit 6a28518

Browse files
torvaldsgitster
authored andcommitted
Ignore leading empty lines while summarizing merges
"git log" and friends normally skip the initial empty lines when showing one-line summary of a commit, but merge summary didn't. Signed-off-by: Linus Torvalds <[email protected]> ---- builtin-fmt-merge-msg.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48949a1 commit 6a28518

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

builtin-fmt-merge-msg.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,22 @@ static void shortlog(const char *name, unsigned char *sha1,
200200
continue;
201201

202202
bol = strstr(commit->buffer, "\n\n");
203+
if (bol) {
204+
unsigned char c;
205+
do {
206+
c = *++bol;
207+
} while (isspace(c));
208+
if (!c)
209+
bol = NULL;
210+
}
211+
203212
if (!bol) {
204213
append_to_list(&subjects, xstrdup(sha1_to_hex(
205214
commit->object.sha1)),
206215
NULL);
207216
continue;
208217
}
209218

210-
bol += 2;
211219
eol = strchr(bol, '\n');
212220
if (eol) {
213221
oneline = xmemdupz(bol, eol - bol);

0 commit comments

Comments
 (0)