[PATCH 5/5] object.c: clear_commit_marks_all() accept 'r' as parameter
From: Parth Gala via GitGitGadget <hidden>
Date: 2020-02-12 19:19:21
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Parth Gala <redacted> 'clear_commit_marks_all()' and its callers are modified to enable passing 'r' as an argument to 'clear_commit_marks_all()'. Signed-off-by: Parth Gala <redacted> --- builtin/checkout.c | 3 ++- object.c | 6 +++--- object.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index b52c490c8f..bd2b8de8b7 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c@@ -989,6 +989,7 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs) static void orphaned_commit_warning(struct commit *old_commit, struct commit *new_commit) { struct rev_info revs; + struct repository *r = the_repository; struct object *object = &old_commit->object; repo_init_revisions(the_repository, &revs, NULL);
@@ -1011,7 +1012,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); + clear_commit_marks_all(r, ALL_REV_FLAGS); } static int switch_branches(const struct checkout_opts *opts,
diff --git a/object.c b/object.c
index 804488c8dd..2bc08d8df7 100644
--- a/object.c
+++ b/object.c@@ -443,12 +443,12 @@ void clear_object_flags(struct repository *r, unsigned flags) } } -void clear_commit_marks_all(unsigned int flags) +void clear_commit_marks_all(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 bfc95e062a..b0f0bce0a3 100644
--- a/object.h
+++ b/object.h@@ -190,6 +190,6 @@ void clear_object_flags(struct repository *, unsigned flags); /* * Clear the specified object flags from all in-core commit objects. */ -void clear_commit_marks_all(unsigned int flags); +void clear_commit_marks_all(struct repository *, unsigned int flags); #endif /* OBJECT_H */
--
gitgitgadget