diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2009-01-06 21:41:06 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-01-06 22:06:07 -0800 |
commit | cec08717cca468c66eb454c7201fd35f54b48a58 (patch) | |
tree | e9dabc225b562c43a412bd509ec395b4ea6171bf /builtin-shortlog.c | |
parent | f53bd743ff713f6507f28f8e730ac3e27858ab43 (diff) | |
download | git-cec08717cca468c66eb454c7201fd35f54b48a58.tar.gz |
shortlog: handle multi-line subjects like log --pretty=oneline et. al. do
The commit message parser of git shortlog used to treat only the first
non-empty line of the commit message as the subject. Other log commands
(e.g. --pretty=oneline) show the whole first paragraph instead (unwrapped
into a single line).
For consistency, this patch borrows format_subject() from pretty.c to
make shortlog do the same.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-shortlog.c')
-rw-r--r-- | builtin-shortlog.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin-shortlog.c b/builtin-shortlog.c index d03f14fdad..e49290687f 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); |