Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2020-10-31 15:46:08 +0300
committerJunio C Hamano <gitster@pobox.com>2020-10-31 20:46:34 +0300
commitcd8888452cd0e09c9efdc22da729023ae255b54b (patch)
treec9403e7defdf2cba012b1e52a8d9df1273229917
parent69986e19ffcfb9af674ae5180689ab7bbf92ed28 (diff)
object: allow clear_commit_marks_all to handle any repo
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>
-rw-r--r--bisect.c2
-rw-r--r--builtin/checkout.c2
-rw-r--r--builtin/gc.c2
-rw-r--r--object.c6
-rw-r--r--object.h5
5 files changed, 9 insertions, 8 deletions
diff --git a/bisect.c b/bisect.c
index f5b1368128..3b763dab6b 100644
--- 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);
}
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 0951f8fee5..e6f801464d 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -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,
diff --git a/builtin/gc.c b/builtin/gc.c
index 090959350e..e7932f0480 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -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;
}
diff --git a/object.c b/object.c
index 3257518656..05544bc92b 100644
--- 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;
}
diff --git a/object.h b/object.h
index 20b18805f0..59daadce21 100644
--- 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 */