Merge branch 'maint-1.5.4' into maint
[gitweb.git] / builtin-fmt-merge-msg.c
index 6163bd4975e3e361e36ffc89ea4c91d0edd02949..7077d524776e748e0add4ff85478cd62512add15 100644 (file)
@@ -187,7 +187,8 @@ static void shortlog(const char *name, unsigned char *sha1,
        add_pending_object(rev, branch, name);
        add_pending_object(rev, &head->object, "^HEAD");
        head->object.flags |= UNINTERESTING;
-       prepare_revision_walk(rev);
+       if (prepare_revision_walk(rev))
+               die("revision walk setup failed");
        while ((commit = get_revision(rev)) != NULL) {
                char *oneline, *bol, *eol;
 
@@ -200,6 +201,15 @@ static void shortlog(const char *name, unsigned char *sha1,
                        continue;
 
                bol = strstr(commit->buffer, "\n\n");
+               if (bol) {
+                       unsigned char c;
+                       do {
+                               c = *++bol;
+                       } while (isspace(c));
+                       if (!c)
+                               bol = NULL;
+               }
+
                if (!bol) {
                        append_to_list(&subjects, xstrdup(sha1_to_hex(
                                                        commit->object.sha1)),
@@ -207,7 +217,6 @@ static void shortlog(const char *name, unsigned char *sha1,
                        continue;
                }
 
-               bol += 2;
                eol = strchr(bol, '\n');
                if (eol) {
                        oneline = xmemdupz(bol, eol - bol);