]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin-rev-list.c
Drop strbuf's 'eof' marker, and make read_line a first class citizen.
[git.git] / builtin-rev-list.c
index 813aadf596df7fe2e61517915707717120842d74..4fd4b6bec1a91761f2cb5b52ce69d211fa97f78e 100644 (file)
@@ -70,21 +70,9 @@ static void show_commit(struct commit *commit)
        if (revs.parents) {
                struct commit_list *parents = commit->parents;
                while (parents) {
-                       struct object *o = &(parents->item->object);
+                       printf(" %s", sha1_to_hex(parents->item->object.sha1));
                        parents = parents->next;
-                       if (o->flags & TMP_MARK)
-                               continue;
-                       printf(" %s", sha1_to_hex(o->sha1));
-                       o->flags |= TMP_MARK;
                }
-               /* TMP_MARK is a general purpose flag that can
-                * be used locally, but the user should clean
-                * things up after it is done with them.
-                */
-               for (parents = commit->parents;
-                    parents;
-                    parents = parents->next)
-                       parents->item->object.flags &= ~TMP_MARK;
        }
        if (revs.commit_format == CMIT_FMT_ONELINE)
                putchar(' ');
@@ -92,15 +80,14 @@ 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);
+               printf("%s%c", buf.buf, hdr_termination);
+               strbuf_release(&buf);
        }
-       fflush(stdout);
+       maybe_flush_or_die(stdout, "stdout");
        if (commit->parents) {
                free_commit_list(commit->parents);
                commit->parents = NULL;
@@ -312,7 +299,7 @@ static struct commit_list *find_bisection(struct commit_list *list,
        show_list("bisection 2 sorted", 0, nr, list);
 
        *all = nr;
-       weights = xcalloc(on_list, sizeof(int*));
+       weights = xcalloc(on_list, sizeof(*weights));
        counted = 0;
 
        for (n = 0, p = list; p; p = p->next) {