commit: factor out clear_commit_marks_for_object_array

Factor out the code to clear the commit marks for a whole struct
object_array from builtin/checkout.c into its own exported function
clear_commit_marks_for_object_array and use it in bisect and bundle
as well.  It handles tags and commits and ignores objects of any
other type.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2011-10-01 18:16:08 +02:00
committed by Junio C Hamano
parent 1062141928
commit 86a0a408b9
5 changed files with 19 additions and 14 deletions

View File

@ -440,6 +440,20 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
}
}
void clear_commit_marks_for_object_array(struct object_array *a, unsigned mark)
{
struct object *object;
struct commit *commit;
unsigned int i;
for (i = 0; i < a->nr; i++) {
object = a->objects[i].item;
commit = lookup_commit_reference_gently(object->sha1, 1);
if (commit)
clear_commit_marks(commit, mark);
}
}
struct commit *pop_commit(struct commit_list **stack)
{
struct commit_list *top = *stack;