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

Re: [Outreachy PATCH] bundle-uri: use the passed repository for refs and tracing

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 29, 2026, 12:07 UTC
Message-ID
<auM3DGcWTL5OdRnD@pks.im>
In-Reply-To
<20261028093455.76247-1-okhuomonajayi54@gmail.com>
On Wed, Oct 28, 2026 at 10:34:55AM +0100, Okhuomon Ajayi wrote:
Show 6 quoted lines
> unbundle_from_file() receives r and unbundles the objects into
> it, but reads and writes the refs in the_repository.
> fetch_bundle_uri() also has r, but uses the_repository for its
> trace2 region.
> 
> Use r for both.
Okay.
Show 5 quoted lines
> Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
> ---
> unbundle_from_file() still depends on the_repository through
> fetch_pack_fsck_objects(), which reads fetch.fsckObjects and
> transfer.fsckObjects from the_repository's config. I left that out.

That's fine, we know that subsystems may still implicitly depend on it even though they don't declare `USE_THE_REPOSITORY_VARIABLE` anymore.

What I find curious though is why you didn't go the last mile so that we could drop that define from this subsystem altogether. There's only two sites left that use `the_repository`, and both of them are trivial to convert (see below patch).

So shouldn't we maybe also fix those cases while already at it and then drop the define?

Patrick
diff --git a/bundle-uri.c b/bundle-uri.c
index 1f1683b52e9..abdb99f4375 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -285,7 +285,7 @@ int bundle_uri_parse_config_format(const char *uri,
 	return result;
 }
 
-static char *find_temp_filename(void)
+static char *find_temp_filename(struct repository *r)
 {
 	int fd;
 	struct strbuf name = STRBUF_INIT;
@@ -293,7 +293,7 @@ static char *find_temp_filename(void)
 	 * Find a temporary filename that is available. This is briefly
 	 * racy, but unlikely to collide.
 	 */
-	fd = odb_mkstemp(the_repository->objects, &name,
+	fd = odb_mkstemp(r->objects, &name,
 			 "bundles/tmp_uri_XXXXXX");
 	if (fd < 0) {
 		warning(_("failed to create temporary file"));
@@ -383,7 +383,7 @@ static int download_https_uri_to_file(const char *file, const char *uri)
 	return result;
 }
 
-static int copy_uri_to_file(const char *filename, const char *uri)
+static int copy_uri_to_file(struct repository *r, const char *filename, const char *uri)
 {
 	const char *out;
 
@@ -395,7 +395,7 @@ static int copy_uri_to_file(const char *filename, const char *uri)
 		uri = out;
 
 	/* Copy as a file */
-	return copy_file(the_repository, filename, uri, 0);
+	return copy_file(r, filename, uri, 0);
 }
 
 static int unbundle_from_file(struct repository *r, const char *file)
@@ -773,12 +773,12 @@ static int fetch_bundle_uri_internal(struct repository *r,
 	}
 
 	if (!bundle->file &&
-	    !(bundle->file = find_temp_filename())) {
+	    !(bundle->file = find_temp_filename(r))) {
 		result = -1;
 		goto cleanup;
 	}
 
-	if ((result = copy_uri_to_file(bundle->file, bundle->uri))) {
+	if ((result = copy_uri_to_file(r, bundle->file, bundle->uri))) {
 		warning(_("failed to download bundle from URI '%s'"), bundle->uri);
 		goto cleanup;
 	}
Previous: Junio C HamanoNext: Okhuomon Ajayi
Message 5 of 8 in “bundle-uri: use the passed repository for refs and tracing”
  1. bundle-uri: use the passed repository for refs and tracingOkhuomon Ajayi, Oct 28, 2026
  2. Karthik NayakOct 28, 2026
  3. Okhuomon AjayiOct 28, 2026
  4. Junio C HamanoOct 28, 2026
  5. Patrick SteinhardtOct 29, 2026
  6. Okhuomon AjayiOct 29, 2026
  7. bundle-uri: stop using the_repositoryOkhuomon Ajayi, Oct 29, 2026
  8. Patrick SteinhardtOct 29, 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.