From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <gitster@pobox.com>
Cc: markus.heidelberg@web.de, git@vger.kernel.org
Subject: Re: [PATCH 3/3] pretty: support multiline subjects with format:
Date: Mon, 29 Dec 2008 23:15:50 +0100 [thread overview]
Message-ID: <49594C16.2010406@lsrfire.ath.cx> (raw)
In-Reply-To: <4956C47B.4020602@lsrfire.ath.cx>
René Scharfe schrieb:
> Markus Heidelberg schrieb:
>> Sorry, I haven't tested your patch set, what is the output of
>> git-shortlog like now?
>
> It's unchanged since it has it's own commit message parser.
... which displays the first line of the commit message, unlike
--pretty=oneline. Here's a quick fix. I probably won't have time
to come up with something prettier this year.
René
builtin-shortlog.c | 9 ++++++---
pretty.c | 4 ++--
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index d03f14f..e492906 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -29,6 +29,9 @@ static int compare_by_number(const void *a1, const void *a2)
return -1;
}
+const char *format_subject(struct strbuf *sb, const char *msg,
+ const char *line_separator);
+
static void insert_one_record(struct shortlog *log,
const char *author,
const char *oneline)
@@ -41,6 +44,7 @@ static void insert_one_record(struct shortlog *log,
size_t len;
const char *eol;
const char *boemail, *eoemail;
+ struct strbuf subject = STRBUF_INIT;
boemail = strchr(author, '<');
if (!boemail)
@@ -89,9 +93,8 @@ static void insert_one_record(struct shortlog *log,
while (*oneline && isspace(*oneline) && *oneline != '\n')
oneline++;
len = eol - oneline;
- while (len && isspace(oneline[len-1]))
- len--;
- buffer = xmemdupz(oneline, len);
+ format_subject(&subject, oneline, " ");
+ buffer = strbuf_detach(&subject, NULL);
if (dot3) {
int dot3len = strlen(dot3);
diff --git a/pretty.c b/pretty.c
index 343dca5..421d9c5 100644
--- a/pretty.c
+++ b/pretty.c
@@ -486,8 +486,8 @@ static void parse_commit_header(struct format_commit_context *context)
context->commit_header_parsed = 1;
}
-static const char *format_subject(struct strbuf *sb, const char *msg,
- const char *line_separator)
+const char *format_subject(struct strbuf *sb, const char *msg,
+ const char *line_separator)
{
int first = 1;
next prev parent reply other threads:[~2008-12-29 22:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-27 0:32 [PATCH 1/3] pretty: factor out skip_empty_lines() René Scharfe
2008-12-27 0:39 ` [PATCH 2/3] pretty: factor out format_subject() René Scharfe
2008-12-27 0:49 ` [PATCH 3/3] pretty: support multiline subjects with format: René Scharfe
2008-12-27 23:24 ` Markus Heidelberg
2008-12-28 0:12 ` René Scharfe
2008-12-28 14:16 ` Markus Heidelberg
2008-12-29 22:15 ` René Scharfe [this message]
2009-01-04 10:01 ` Junio C Hamano
2009-01-06 20:41 ` [PATCH 4/3] shortlog: handle multi-line subjects like log --pretty=oneline et. al. do René Scharfe
2009-01-07 21:19 ` Junio C Hamano
2008-12-28 0:13 ` [PATCH 3/3] pretty: support multiline subjects with format: Junio C Hamano
2008-12-28 14:26 ` Markus Heidelberg
2008-12-28 0:09 ` Nanako Shiraishi
2008-12-28 1:44 ` Miklos Vajna
2008-12-28 14:08 ` Markus Heidelberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49594C16.2010406@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=markus.heidelberg@web.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).