{"thread":{"id":"54541","subject":"[PATCH v2 1/2] object: allow clear_commit_marks_all to handle any repo","startedAt":"2020-10-31T12:46:14Z","lastAt":"2020-10-31T12:48:06Z","messageCount":2,"participants":["René Scharfe"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"408784","messageId":"eaefaf80-d2da-7bd0-a85f-00dfd46b7754@web.de","threadId":"54541","inReplyTo":null,"subject":"[PATCH v2 1/2] object: allow clear_commit_marks_all to handle any repo","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2020-10-31T12:46:08Z","receivedAt":"2020-10-31T12:46:14Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Allow callers to specify the repository to use.  Rename the function to\nrepo_clear_commit_marks to document its new scope.  No functional change\nintended.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\nChanges from v1: Renamed the function; the \"_all\" part became misleading\nwhen it became possible to represent multiple repositories, but the\nfunction was still only operating on one of them.\n\n bisect.c           | 2 +-\n builtin/checkout.c | 2 +-\n builtin/gc.c       | 2 +-\n object.c           | 6 +++---\n object.h           | 5 +++--\n 5 files changed, 9 insertions(+), 8 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex f5b1368128..3b763dab6b 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -1090,7 +1090,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)\n \t\t  nr), nr, steps_msg);\n \tfree(steps_msg);\n \t/* Clean up objects used, as they will be reused. */\n-\tclear_commit_marks_all(ALL_REV_FLAGS);\n+\trepo_clear_commit_marks(the_repository, ALL_REV_FLAGS);\n\n \treturn bisect_checkout(bisect_rev, no_checkout);\n }\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 7c311cecb3..9b82119129 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -1042,7 +1042,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne\n \t\tdescribe_detached_head(_(\"Previous HEAD position was\"), old_commit);\n\n \t/* Clean up objects used, as they will be reused. */\n-\tclear_commit_marks_all(ALL_REV_FLAGS);\n+\trepo_clear_commit_marks(the_repository, ALL_REV_FLAGS);\n }\n\n static int switch_branches(const struct checkout_opts *opts,\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 2b99596ec8..4ff1894810 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -788,7 +788,7 @@ static int should_write_commit_graph(void)\n\n \tresult = for_each_ref(dfs_on_ref, &data);\n\n-\tclear_commit_marks_all(SEEN);\n+\trepo_clear_commit_marks(the_repository, SEEN);\n\n \treturn result;\n }\ndiff --git a/object.c b/object.c\nindex 3257518656..05544bc92b 100644\n--- a/object.c\n+++ b/object.c\n@@ -453,12 +453,12 @@ void clear_object_flags(unsigned flags)\n \t}\n }\n\n-void clear_commit_marks_all(unsigned int flags)\n+void repo_clear_commit_marks(struct repository *r, unsigned int flags)\n {\n \tint i;\n\n-\tfor (i = 0; i < the_repository->parsed_objects->obj_hash_size; i++) {\n-\t\tstruct object *obj = the_repository->parsed_objects->obj_hash[i];\n+\tfor (i = 0; i < r->parsed_objects->obj_hash_size; i++) {\n+\t\tstruct object *obj = r->parsed_objects->obj_hash[i];\n \t\tif (obj && obj->type == OBJ_COMMIT)\n \t\t\tobj->flags &= ~flags;\n \t}\ndiff --git a/object.h b/object.h\nindex 20b18805f0..59daadce21 100644\n--- a/object.h\n+++ b/object.h\n@@ -191,8 +191,9 @@ void object_array_clear(struct object_array *array);\n void clear_object_flags(unsigned flags);\n\n /*\n- * Clear the specified object flags from all in-core commit objects.\n+ * Clear the specified object flags from all in-core commit objects from\n+ * the specified repository.\n  */\n-void clear_commit_marks_all(unsigned int flags);\n+void repo_clear_commit_marks(struct repository *r, unsigned int flags);\n\n #endif /* OBJECT_H */\n--\n2.29.2\n\n"},{"id":"408785","messageId":"1d12a06f-b1ce-ae49-a18e-579d8def3133@web.de","threadId":"54541","inReplyTo":"eaefaf80-d2da-7bd0-a85f-00dfd46b7754@web.de","subject":"[PATCH v2 2/2] bisect: clear flags in passed repository","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2020-10-31T12:47:58Z","receivedAt":"2020-10-31T12:48:06Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"69d2cfe6e8 (bisect.c: remove the_repository reference, 2018-11-10) kept\nthe implicit the_repository reference in clear_commit_marks_all, which\nwas made explicit by the previous commit (and which also renamed it to\nrepo_clear_commit_marks).  Replace it as well.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\n---\n bisect.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex 3b763dab6b..58bc9c73a4 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -1090,7 +1090,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)\n \t\t  nr), nr, steps_msg);\n \tfree(steps_msg);\n \t/* Clean up objects used, as they will be reused. */\n-\trepo_clear_commit_marks(the_repository, ALL_REV_FLAGS);\n+\trepo_clear_commit_marks(r, ALL_REV_FLAGS);\n\n \treturn bisect_checkout(bisect_rev, no_checkout);\n }\n--\n2.29.2\n\n"}]}