Re: [GIT PULL] sh updates for 2.6.25
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:44:29
Also in:
linux-sh
Linus Torvalds [off-list ref] writes:
Junio? Something like this for the merge summary code? (It also turns an empty commit message with just whitespace in the commit message into the SHA1 hex string)
Yeah, your patch makes sense, but it also makes me wonder if we should fix the code in pretty.c::parse_commit_header() that grabs the "subject" line, and use format_commit_message() with "%s" format here. Interested people then can enhance it to take custom format string.
quoted hunk
Linus ---- builtin-fmt-merge-msg.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c index ebb3f37..7077d52 100644 --- a/builtin-fmt-merge-msg.c +++ b/builtin-fmt-merge-msg.c@@ -201,6 +201,15 @@ static void shortlog(const char *name, unsigned char *sha1, continue; bol = strstr(commit->buffer, "\n\n"); + if (bol) { + unsigned char c; + do { + c = *++bol; + } while (isspace(c)); + if (!c) + bol = NULL; + } + if (!bol) { append_to_list(&subjects, xstrdup(sha1_to_hex( commit->object.sha1)),@@ -208,7 +217,6 @@ static void shortlog(const char *name, unsigned char *sha1, continue; } - bol += 2; eol = strchr(bol, '\n'); if (eol) { oneline = xmemdupz(bol, eol - bol);