Code

Merge branch 'rs/maint-shortlog-foldline' into maint
authorJunio C Hamano <gitster@pobox.com>
Sat, 24 Jan 2009 03:03:50 +0000 (19:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 24 Jan 2009 03:03:50 +0000 (19:03 -0800)
* rs/maint-shortlog-foldline:
  shortlog: handle multi-line subjects like log --pretty=oneline et. al. do

builtin-shortlog.c
pretty.c

index d03f14fdad3d17dde06734d78ddb4aade6ed4f2b..e49290687f2a0c55317398ef8b04ac319018c91b 100644 (file)
@@ -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);
index 343dca556cc73031bb073b6ebf8bf511db3a60c4..421d9c5bca2224777808ccc06fe4912ba8793229 100644 (file)
--- 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;