summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2011-10-01 16:16:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-10-03 18:15:34 (GMT)
commit86a0a408b900eecc9d0d4a1eb8ae223181e96679 (patch)
treeeb8bb329861f3d6a9868025551f30c835b1b99f0 /commit.c
parent1062141928aaa1d272be8ce007d371168e8daef6 (diff)
downloadgit-86a0a408b900eecc9d0d4a1eb8ae223181e96679.zip
git-86a0a408b900eecc9d0d4a1eb8ae223181e96679.tar.gz
git-86a0a408b900eecc9d0d4a1eb8ae223181e96679.tar.bz2
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>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index ac337c7..4d80f25 100644
--- a/commit.c
+++ b/commit.c
@@ -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;