git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] object.c: clear_commit_marks_all() accept 'r' as parameter

From
PGParth Gala via GitGitGadget <gitgitgadget@gmail.com>
Date
Feb 12, 2020, 19:19 UTC
Message-ID
<746d9ff810c384db8568c75472b18f8a9afec5fb.1581535151.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.545.git.1581535151.gitgitgadget@gmail.com>
From: Parth Gala <parthpgala@gmail.com>

'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 <parthpgala@gmail.com>
---
 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
Previous: Taylor BlauNext: Taylor Blau
Message 15 of 17 in “object.c: localize global the_repository variable into r”
  1. 0/5 object.c: localize global the_repository variable into rParth Gala via GitGitGadget, Feb 12, 2020
  2. 3/5 object.c: parse_object_or_die() accept 'r' as parameterParth Gala via GitGitGadget, Feb 12, 2020
  3. 1/5 object.c: get_max_object_index and get_indexed_object accept 'r' parameterParth Gala via GitGitGadget, Feb 12, 2020
  4. Taylor BlauFeb 12, 2020
  5. Eric SunshineFeb 12, 2020
  6. parth galaFeb 13, 2020
  7. 4/5 object.c: clear_object_flags() accept 'r' as parameterParth Gala via GitGitGadget, Feb 12, 2020
  8. 2/5 object.c: lookup_unknown_object() accept 'r' as parameterParth Gala via GitGitGadget, Feb 12, 2020
  9. Taylor BlauFeb 12, 2020
  10. Junio C HamanoFeb 12, 2020
  11. Taylor BlauFeb 13, 2020
  12. Junio C HamanoFeb 13, 2020
  13. Jeff KingFeb 13, 2020
  14. Taylor BlauFeb 15, 2020
  15. 5/5 object.c: clear_commit_marks_all() accept 'r' as parameterParth Gala via GitGitGadget, Feb 12, 2020
  16. Taylor BlauFeb 12, 2020
  17. parth galaFeb 13, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.