object: add clear_commit_marks_all()

Add a function for clearing the commit marks of all in-core commit objects. It's similar to clear_object_flags(), but more precise, since it leaves the other object types alone. It still has to iterate through them, though. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Dec 25, 2017 at 18:44 UTC 4ad315fc99d906364c9a5d75a319752cf4056ae5
2 files changed +16
object.c
+11
@@ -434,3 +434,14 @@ void clear_object_flags(unsigned flags)
434 obj->flags &= ~flags;
435 }
436 }
437 +
438 +void clear_commit_marks_all(unsigned int flags)
439 +{
440 + int i;
441 +
442 + for (i = 0; i < obj_hash_size; i++) {
443 + struct object *obj = obj_hash[i];
444 + if (obj && obj->type == OBJ_COMMIT)
445 + obj->flags &= ~flags;
446 + }
447 +}
object.h
+5
@@ -148,4 +148,9 @@ void object_array_clear(struct object_array *array);
148
149 void clear_object_flags(unsigned flags);
150
151 +/*
152 + * Clear the specified object flags from all in-core commit objects.
153 + */
154 +extern void clear_commit_marks_all(unsigned int flags);
155 +
156 #endif /* OBJECT_H */