summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-01-23 19:03:50 -0800
committerJunio C Hamano <gitster@pobox.com>2009-01-23 19:03:50 -0800
commit46cdcc627522b83bbf1d60fb3bf703b88d237dc0 (patch)
tree232e0eba127f643c01f2306752809901c6c0cbf1
parent67b175bb11d66329f9257368a6e75dfd26d0670f (diff)
parentcec08717cca468c66eb454c7201fd35f54b48a58 (diff)
downloadgit-46cdcc627522b83bbf1d60fb3bf703b88d237dc0.tar.gz
Merge branch 'rs/maint-shortlog-foldline' into maint
* rs/maint-shortlog-foldline: shortlog: handle multi-line subjects like log --pretty=oneline et. al. do
-rw-r--r--builtin-shortlog.c9
-rw-r--r--pretty.c4
2 files changed, 8 insertions, 5 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);
diff --git a/pretty.c b/pretty.c
index 343dca556c..421d9c5bca 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;