]> git.ipfire.org Git - thirdparty/git.git/blobdiff - bisect.c
Git 1.7.8-rc2
[thirdparty/git.git] / bisect.c
index de05bf824620324e42b7a27571ecd3e763cf7e8f..6e186e29cc4a6a74944798e8c4248219e9c5997f 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -800,25 +800,25 @@ static int check_ancestors(const char *prefix)
 {
        struct rev_info revs;
        struct object_array pending_copy;
-       int i, res;
+       int res;
 
        bisect_rev_setup(&revs, prefix, "^%s", "%s", 0);
 
        /* Save pending objects, so they can be cleaned up later. */
-       memset(&pending_copy, 0, sizeof(pending_copy));
-       for (i = 0; i < revs.pending.nr; i++)
-               add_object_array(revs.pending.objects[i].item,
-                                revs.pending.objects[i].name,
-                                &pending_copy);
+       pending_copy = revs.pending;
+       revs.leak_pending = 1;
 
+       /*
+        * bisect_common calls prepare_revision_walk right away, which
+        * (together with .leak_pending = 1) makes us the sole owner of
+        * the list of pending objects.
+        */
        bisect_common(&revs);
        res = (revs.commits != NULL);
 
        /* Clean up objects used, as they will be reused. */
-       for (i = 0; i < pending_copy.nr; i++) {
-               struct object *o = pending_copy.objects[i].item;
-               clear_commit_marks((struct commit *)o, ALL_REV_FLAGS);
-       }
+       clear_commit_marks_for_object_array(&pending_copy, ALL_REV_FLAGS);
+       free(pending_copy.objects);
 
        return res;
 }