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

[Outreachy PATCH] merge-blobs: stop using the_repository

From
OAOkhuomon Ajayi <okhuomonajayi54@gmail.com>
Date
Oct 17, 2026, 10:52 UTC
Message-ID
<20261017105244.90295-1-okhuomonajayi54@gmail.com>

merge_blobs() already has the repository through istate. Pass it to fill_mmfile_blob() and use it when reading objects.

Remove the USE_THE_REPOSITORY_VARIABLE definition and include the headers needed for the structure definitions.

Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
 merge-blobs.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/merge-blobs.c b/merge-blobs.c
index 49dbec9529..1b0621c814 100644
--- a/merge-blobs.c
+++ b/merge-blobs.c
@@ -1,18 +1,19 @@
-#define USE_THE_REPOSITORY_VARIABLE
-
 #include "git-compat-util.h"
 #include "merge-ll.h"
 #include "blob.h"
 #include "merge-blobs.h"
 #include "odb.h"
+#include "read-cache-ll.h"
+#include "repository.h"
 
-static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
+static int fill_mmfile_blob(struct repository *r, mmfile_t *f,
+			    struct blob *obj)
 {
 	void *buf;
 	size_t size;
 	enum object_type type;
 
-	buf = odb_read_object(the_repository->objects, &obj->object.oid,
+	buf = odb_read_object(r->objects, &obj->object.oid,
 			      &type, &size);
 	if (!buf)
 		return -1;
@@ -79,17 +80,17 @@ void *merge_blobs(struct index_state *istate, const char *path,
 			return NULL;
 		if (!our)
 			our = their;
-		return odb_read_object(the_repository->objects, &our->object.oid,
+		return odb_read_object(istate->repo->objects, &our->object.oid,
 				       &type, size);
 	}
 
-	if (fill_mmfile_blob(&f1, our) < 0)
+	if (fill_mmfile_blob(istate->repo, &f1, our) < 0)
 		goto out_no_mmfile;
-	if (fill_mmfile_blob(&f2, their) < 0)
+	if (fill_mmfile_blob(istate->repo, &f2, their) < 0)
 		goto out_free_f1;
 
 	if (base) {
-		if (fill_mmfile_blob(&common, base) < 0)
+		if (fill_mmfile_blob(istate->repo, &common, base) < 0)
 			goto out_free_f2_f1;
 	} else {
 		common.ptr = xstrdup("");
-- 
2.54.0
Next: Usman Akinyemi
Message 1 of 6 in “merge-blobs: stop using the_repository”
  1. merge-blobs: stop using the_repositoryOkhuomon Ajayi, Oct 17, 2026
  2. Usman AkinyemiOct 20, 2026
  3. Okhuomon AjayiOct 20, 2026
  4. Junio C HamanoOct 20, 2026
  5. Usman AkinyemiOct 20, 2026
  6. Junio C HamanoNov 7, 2026

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.