Merge branch 'rs/pending'

* rs/pending:
  commit: factor out clear_commit_marks_for_object_array
  checkout: use leak_pending flag
  bundle: use leak_pending flag
  bisect: use leak_pending flag
  revision: add leak_pending flag
  checkout: use add_pending_{object,sha1} in orphan check
  revision: factor out add_pending_sha1
  checkout: check for "Previous HEAD" notice in t2020

Conflicts:
	builtin/checkout.c
	revision.c
This commit is contained in:
Junio C Hamano
2011-10-13 19:03:22 -07:00
8 changed files with 64 additions and 49 deletions

View File

@ -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;
}