]> git.ipfire.org Git - thirdparty/git.git/commitdiff
object: allow clear_commit_marks_all to handle any repo
authorRené Scharfe <l.s.r@web.de>
Sat, 31 Oct 2020 12:46:08 +0000 (13:46 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 31 Oct 2020 17:46:34 +0000 (10:46 -0700)
Allow callers to specify the repository to use.  Rename the function to
repo_clear_commit_marks to document its new scope.  No functional change
intended.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bisect.c
builtin/checkout.c
builtin/gc.c
object.c
object.h

index f5b13681288cc4a677e6531cc57ab0f3ee04b7ac..3b763dab6be1127320e9ccea10a95f021cda793a 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -1090,7 +1090,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
                  nr), nr, steps_msg);
        free(steps_msg);
        /* Clean up objects used, as they will be reused. */
-       clear_commit_marks_all(ALL_REV_FLAGS);
+       repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
 
        return bisect_checkout(bisect_rev, no_checkout);
 }
index 0951f8fee5cc2a88ac9e08009a69eaf446b6fed4..e6f801464d5f1318b7dafa5eff92f6de5da4848a 100644 (file)
@@ -1029,7 +1029,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
                describe_detached_head(_("Previous HEAD position was"), old_commit);
 
        /* Clean up objects used, as they will be reused. */
-       clear_commit_marks_all(ALL_REV_FLAGS);
+       repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
 }
 
 static int switch_branches(const struct checkout_opts *opts,
index 090959350e06c0821889cab4d3a217ef814e5618..e7932f0480c633df8eb4329d3848d33bc20695be 100644 (file)
@@ -786,7 +786,7 @@ static int should_write_commit_graph(void)
 
        result = for_each_ref(dfs_on_ref, &data);
 
-       clear_commit_marks_all(SEEN);
+       repo_clear_commit_marks(the_repository, SEEN);
 
        return result;
 }
index 32575186562507b2774c6abf097df7810e9cce5e..05544bc92ba8e9751a773d489cf82ba4a936194d 100644 (file)
--- a/object.c
+++ b/object.c
@@ -453,12 +453,12 @@ void clear_object_flags(unsigned flags)
        }
 }
 
-void clear_commit_marks_all(unsigned int flags)
+void repo_clear_commit_marks(struct repository *r, unsigned int flags)
 {
        int i;
 
-       for (i = 0; i < the_repository->parsed_objects->obj_hash_size; i++) {
-               struct object *obj = the_repository->parsed_objects->obj_hash[i];
+       for (i = 0; i < r->parsed_objects->obj_hash_size; i++) {
+               struct object *obj = r->parsed_objects->obj_hash[i];
                if (obj && obj->type == OBJ_COMMIT)
                        obj->flags &= ~flags;
        }
index 20b18805f08f6eb2d472abc377b3766594dc4e78..59daadce21453c707bb439d047725b40d95f153d 100644 (file)
--- a/object.h
+++ b/object.h
@@ -191,8 +191,9 @@ void object_array_clear(struct object_array *array);
 void clear_object_flags(unsigned flags);
 
 /*
- * Clear the specified object flags from all in-core commit objects.
+ * Clear the specified object flags from all in-core commit objects from
+ * the specified repository.
  */
-void clear_commit_marks_all(unsigned int flags);
+void repo_clear_commit_marks(struct repository *r, unsigned int flags);
 
 #endif /* OBJECT_H */