Code

merge-recursive: use find_commit_subject() instead of custom code
authorChristian Couder <chriscool@tuxfamily.org>
Thu, 22 Jul 2010 13:18:34 +0000 (15:18 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Jul 2010 23:12:47 +0000 (16:12 -0700)
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c

index 206c1036359ce7b1fc5a1f5734b2d0bc2a760d90..34837bd5d4111eb73715055f7d547a5a592835b4 100644 (file)
@@ -136,16 +136,10 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
                if (parse_commit(commit) != 0)
                        printf("(bad commit)\n");
                else {
-                       const char *s;
-                       int len;
-                       for (s = commit->buffer; *s; s++)
-                               if (*s == '\n' && s[1] == '\n') {
-                                       s += 2;
-                                       break;
-                               }
-                       for (len = 0; s[len] && '\n' != s[len]; len++)
-                               ; /* do nothing */
-                       printf("%.*s\n", len, s);
+                       const char *title;
+                       int len = find_commit_subject(commit->buffer, &title);
+                       if (len)
+                               printf("%.*s\n", len, title);
                }
        }
 }