bisect: use find_commit_subject() instead of custom code
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Jul 22, 2010 at 15:18 UTC
56ff37941eb76d3f0097884715ca8b391788a3c9
1 file changed
+5
-8
bisect.c
+5
-8
@@ -141,7 +141,8 @@ static void show_list(const char *debug, int counted, int nr,
141
enum object_type type;
142
unsigned long size;
143
char *buf = read_sha1_file(commit->object.sha1, &type, &size);
144
- char *ep, *sp;
144
+ const char *subject_start;
145
+ int subject_len;
146
147
fprintf(stderr, "%c%c%c ",
148
(flags & TREESAME) ? ' ' : 'T',
@@ -156,13 +157,9 @@ static void show_list(const char *debug, int counted, int nr,
157
fprintf(stderr, " %.*s", 8,
158
sha1_to_hex(pp->item->object.sha1));
159
159
- sp = strstr(buf, "\n\n");
160
- if (sp) {
161
- sp += 2;
162
- for (ep = sp; *ep && *ep != '\n'; ep++)
163
- ;
164
- fprintf(stderr, " %.*s", (int)(ep - sp), sp);
165
- }
160
+ subject_len = find_commit_subject(buf, &subject_start);
161
+ if (subject_len)
162
+ fprintf(stderr, " %.*s", subject_len, subject_start);
163
fprintf(stderr, "\n");
164
}
165
}