summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f53bd74)
raw | patch | inline | side by side (parent: f53bd74)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Tue, 6 Jan 2009 20:41:06 +0000 (21:41 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 7 Jan 2009 06:06:07 +0000 (22:06 -0800) |
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>
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>
builtin-shortlog.c | patch | blob | history | |
pretty.c | patch | blob | history |
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index d03f14fdad3d17dde06734d78ddb4aade6ed4f2b..e49290687f2a0c55317398ef8b04ac319018c91b 100644 (file)
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
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)
size_t len;
const char *eol;
const char *boemail, *eoemail;
+ struct strbuf subject = STRBUF_INIT;
boemail = strchr(author, '<');
if (!boemail)
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 343dca556cc73031bb073b6ebf8bf511db3a60c4..421d9c5bca2224777808ccc06fe4912ba8793229 100644 (file)
--- a/pretty.c
+++ b/pretty.c
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;