{"thread":{"id":"54540","subject":"[PATCH 1/2] object: allow clear_commit_marks_all() to handle any repo","startedAt":"2020-10-31T12:21:12Z","lastAt":"2020-10-31T12:31:31Z","messageCount":2,"participants":["René Scharfe"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"408782","messageId":"f8cce944-a094-6097-39c3-904f52e4b9f6@web.de","threadId":"54540","inReplyTo":null,"subject":"[PATCH 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:21:01Z","receivedAt":"2020-10-31T12:21:12Z","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.  No functional change\nintended.\n\nSigned-off-by: René Scharfe <l.s.r@web.de>\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..ee7f7bd017 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+\tclear_commit_marks_all(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..49d599a994 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+\tclear_commit_marks_all(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..4e3a904f70 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+\tclear_commit_marks_all(the_repository, SEEN);\n\n \treturn result;\n }\ndiff --git a/object.c b/object.c\nindex 3257518656..27cc72fc7c 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 clear_commit_marks_all(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..eccacc8bb8 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 clear_commit_marks_all(struct repository *r, unsigned int flags);\n\n #endif /* OBJECT_H */\n--\n2.29.2\n"},{"id":"408783","messageId":"e9f1dbc1-065b-dcf7-efc1-7709681de5f1@web.de","threadId":"54540","inReplyTo":"f8cce944-a094-6097-39c3-904f52e4b9f6@web.de","subject":"[PATCH 2/2] bisect: clear flags in passed repository","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2020-10-31T12:31:25Z","receivedAt":"2020-10-31T12:31:31Z","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,\n2018-11-10) kept the implicit the_repository reference lurking\nin clear_commit_marks_all().  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 ee7f7bd017..453bf10a0c 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(the_repository, ALL_REV_FLAGS);\n+\tclear_commit_marks_all(r, ALL_REV_FLAGS);\n\n \treturn bisect_checkout(bisect_rev, no_checkout);\n }\n--\n2.29.2\n\n"}]}