🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
1 messages
1 total messages Started by Okhuomon Ajayi Thu, 29 Oct 2026 19:41
[Outreachy PATCH] pseudo-merge: use writer->repo instead of the_repository
#1853
Author: Okhuomon Ajayi
Date: Thu, 29 Oct 2026 19:41
99 lines
13903 bytes
The functions in pseudo-merge.c receive a bitmap_writer whose repo
field names the repository the bitmap is written for, yet they
look up commits, peel refs, show progress and walk refs in
the_repository. push_pseudo_merge() also allocates its commits in
the_repository. If the writer was set up for another repository,
these functions would still read from the global one.

Use writer->repo instead. push_pseudo_merge() does not have the
writer, so add a repository parameter to it and let its callers in
select_pseudo_merges_1() pass writer->repo.

Drop USE_THE_REPOSITORY_VARIABLE, as pseudo-merge.c no longer uses
the_repository.

Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
 pseudo-merge.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/pseudo-merge.c b/pseudo-merge.c
index 22b8600d68..368c56efc2 100644
--- a/pseudo-merge.c
+++ b/pseudo-merge.c
@@ -1,4 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
 #define DISABLE_SIGN_COMPARE_WARNINGS
 
 #include "git-compat-util.h"
@@ -233,13 +232,13 @@ static int find_pseudo_merge_group_for_ref(const struct reference *ref, void *_d
 	uint32_t i;
 	int has_bitmap;
 
-	if (!reference_get_peeled_oid(the_repository, ref, &peeled))
+	if (!reference_get_peeled_oid(writer->repo, ref, &peeled))
 		maybe_peeled = &peeled;
 
-	c = lookup_commit(the_repository, maybe_peeled);
+	c = lookup_commit(writer->repo, maybe_peeled);
 	if (!c)
 		return 0;
-	if (repo_parse_commit(the_repository, c))
+	if (repo_parse_commit(writer->repo, c))
 		return 0;
 	if (!packlist_find(writer->to_pack, maybe_peeled))
 		return 0;
@@ -298,13 +297,14 @@ static int find_pseudo_merge_group_for_ref(const struct reference *ref, void *_d
 	return 0;
 }
 
-static struct commit *push_pseudo_merge(struct pseudo_merge_group *group)
+static struct commit *push_pseudo_merge(struct repository *r,
+					struct pseudo_merge_group *group)
 {
 	struct commit *merge;
 
 	ALLOC_GROW(group->merges, group->merges_nr + 1, group->merges_alloc);
 
-	merge = alloc_commit_node(the_repository);
+	merge = alloc_commit_node(r);
 	merge->object.parsed = 1;
 	merge->object.flags |= BITMAP_PSEUDO_MERGE;
 
@@ -353,7 +353,7 @@ static void select_pseudo_merges_1(struct bitmap_writer *writer,
 		struct commit *merge;
 		struct commit_list **p;
 
-		merge = push_pseudo_merge(group);
+		merge = push_pseudo_merge(writer->repo, group);
 		p = &merge->parents;
 
 		/*
@@ -395,7 +395,7 @@ static void select_pseudo_merges_1(struct bitmap_writer *writer,
 		struct commit_list **p;
 		uint32_t size, end;
 
-		merge = push_pseudo_merge(group);
+		merge = push_pseudo_merge(writer->repo, group);
 		p = &merge->parents;
 
 		size = pseudo_merge_group_size(group, matches, i);
@@ -461,11 +461,11 @@ void select_pseudo_merges(struct bitmap_writer *writer)
 		return;
 
 	if (writer->show_progress)
-		progress = start_progress(the_repository,
+		progress = start_progress(writer->repo,
 					  "Selecting pseudo-merge commits",
 					  writer->pseudo_merge_groups.nr);
 
-	refs_for_each_ref(get_main_ref_store(the_repository),
+	refs_for_each_ref(get_main_ref_store(writer->repo),
 			  find_pseudo_merge_group_for_ref, writer);
 
 	for (i = 0; i < writer->pseudo_merge_groups.nr; i++) {

base-commit: 8d1b215c01512b9658d4525c54ff9b9245f9a7e8
-- 
2.56.0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads