X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=bisect.c;h=6e186e29cc4a6a74944798e8c4248219e9c5997f;hb=19a6cd372a998df3079d870e02c064c5bb101841;hp=de05bf824620324e42b7a27571ecd3e763cf7e8f;hpb=901c907d83f523a5df0b10c0aafb19c512836624;p=git.git diff --git a/bisect.c b/bisect.c index de05bf824..6e186e29c 100644 --- 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; }