summaryrefslogtreecommitdiff
path: root/bisect.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-12-16 13:12:16 +0100
committerJunio C Hamano <gitster@pobox.com>2017-12-19 10:35:00 -0800
commit01f9c59ae6f3ab25bbe13c47d3081394ebeeb89d (patch)
tree108e9b93469fb3958f3ef784f54436e224d48ea0 /bisect.c
parent3013dff8662eae06457fe6e5348dfe2270810ab2 (diff)
downloadgit-rs/revision-keep-pending.tar.gz
revision: introduce prepare_revision_walk_extended()rs/revision-keep-pending
prepare_revision_walk() allows callers to take ownership of the array of pending objects by setting the rev_info flag "leak_pending" and copying the object_array "pending". They use it to clear commit marks after setup is done. This interface is brittle enough that it requires extensive comments. Provide an easier way by adding a function that can hand over the array to a caller-supplied output parameter and converting all users of the flag "leak_pending" to call prepare_revision_walk_extended() instead. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'bisect.c')
-rw-r--r--bisect.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/bisect.c b/bisect.c
index 3756f127b0..3539cc9c61 100644
--- a/bisect.c
+++ b/bisect.c
@@ -636,9 +636,10 @@ static void bisect_rev_setup(struct rev_info *revs, const char *prefix,
/* XXX leak rev_argv, as "revs" may still be pointing to it */
}
-static void bisect_common(struct rev_info *revs)
+static void bisect_common(struct rev_info *revs,
+ struct object_array *old_pending_ptr)
{
- if (prepare_revision_walk(revs))
+ if (prepare_revision_walk_extended(revs, old_pending_ptr))
die("revision walk setup failed");
if (revs->tree_objects)
mark_edges_uninteresting(revs, NULL);
@@ -819,15 +820,7 @@ static int check_ancestors(const char *prefix)
bisect_rev_setup(&revs, prefix, "^%s", "%s", 0);
/* Save pending objects, so they can be cleaned up later. */
- 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);
+ bisect_common(&revs, &pending_copy);
res = (revs.commits != NULL);
/* Clean up objects used, as they will be reused. */
@@ -958,7 +951,7 @@ int bisect_next_all(const char *prefix, int no_checkout)
bisect_rev_setup(&revs, prefix, "%s", "^%s", 1);
revs.limited = 1;
- bisect_common(&revs);
+ bisect_common(&revs, NULL);
find_bisection(&revs.commits, &reaches, &all, !!skipped_revs.nr);
revs.commits = managed_skipped(revs.commits, &tried);