All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] object: allow clear_commit_marks_all() to handle any repo
@ 2020-10-31 12:21 René Scharfe
  2020-10-31 12:31 ` [PATCH 2/2] bisect: clear flags in passed repository René Scharfe
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2020-10-31 12:21 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano

Allow callers to specify the repository to use.  No functional change
intended.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 bisect.c           | 2 +-
 builtin/checkout.c | 2 +-
 builtin/gc.c       | 2 +-
 object.c           | 6 +++---
 object.h           | 5 +++--
 5 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/bisect.c b/bisect.c
index f5b1368128..ee7f7bd017 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);
+	clear_commit_marks_all(the_repository, ALL_REV_FLAGS);

 	return bisect_checkout(bisect_rev, no_checkout);
 }
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 7c311cecb3..49d599a994 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1042,7 +1042,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(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 2b99596ec8..4e3a904f70 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -788,7 +788,7 @@ static int should_write_commit_graph(void)

 	result = for_each_ref(dfs_on_ref, &data);

-	clear_commit_marks_all(SEEN);
+	clear_commit_marks_all(the_repository, SEEN);

 	return result;
 }
diff --git a/object.c b/object.c
index 3257518656..27cc72fc7c 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 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 20b18805f0..eccacc8bb8 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 clear_commit_marks_all(struct repository *r, unsigned int flags);

 #endif /* OBJECT_H */
--
2.29.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] bisect: clear flags in passed repository
  2020-10-31 12:21 [PATCH 1/2] object: allow clear_commit_marks_all() to handle any repo René Scharfe
@ 2020-10-31 12:31 ` René Scharfe
  0 siblings, 0 replies; 2+ messages in thread
From: René Scharfe @ 2020-10-31 12:31 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano, Nguyễn Thái Ngọc Duy

69d2cfe6e8 (bisect.c: remove the_repository reference,
2018-11-10) kept the implicit the_repository reference lurking
in clear_commit_marks_all().  Replace it as well.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
 bisect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bisect.c b/bisect.c
index ee7f7bd017..453bf10a0c 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(the_repository, ALL_REV_FLAGS);
+	clear_commit_marks_all(r, ALL_REV_FLAGS);

 	return bisect_checkout(bisect_rev, no_checkout);
 }
--
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-31 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 12:21 [PATCH 1/2] object: allow clear_commit_marks_all() to handle any repo René Scharfe
2020-10-31 12:31 ` [PATCH 2/2] bisect: clear flags in passed repository René Scharfe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.