]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-rev-list.c
Merge git://git.kernel.org/pub/scm/gitk/gitk
[git.git] / builtin-rev-list.c
index 899a31d09ac31aaf1336b5ab3959345ac83a9579..33726b8d8426b4878ed63184dc280957ba4434e0 100644 (file)
@@ -80,13 +80,13 @@ static void show_commit(struct commit *commit)
                putchar('\n');
 
        if (revs.verbose_header) {
-               char *buf = NULL;
-               unsigned long buflen = 0;
-               pretty_print_commit(revs.commit_format, commit, ~0,
-                                   &buf, &buflen,
-                                   revs.abbrev, NULL, NULL, revs.date_mode);
-               printf("%s%c", buf, hdr_termination);
-               free(buf);
+               struct strbuf buf;
+               strbuf_init(&buf, 0);
+               pretty_print_commit(revs.commit_format, commit,
+                                       &buf, revs.abbrev, NULL, NULL, revs.date_mode);
+               if (buf.len)
+                       printf("%s%c", buf.buf, hdr_termination);
+               strbuf_release(&buf);
        }
        maybe_flush_or_die(stdout, "stdout");
        if (commit->parents) {
@@ -436,10 +436,10 @@ static struct commit_list *find_bisection(struct commit_list *list,
        /* Do the real work of finding bisection commit. */
        best = do_find_bisection(list, nr, weights);
 
-       if (best)
+       if (best) {
                best->next = NULL;
-
-       *reaches = weight(best);
+               *reaches = weight(best);
+       }
        free(weights);
 
        return best;