Re: [GIT PULL] sh updates for 2.6.25
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 15, 2008, 18:41 UTC
- Message-ID
- <7vr6d7x8nj.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <alpine.LFD.1.00.0804151048060.2879@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> 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.
Show 34 quoted lines
> 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);