From: Junio C Hamano Date: Mon, 23 Nov 2026 21:04:03 GMT Subject: Re: [PATCH v4 3/3] bundle-uri: do not die on unresolvable relative URIs Message-ID: In-Reply-To: Aniket Gupta writes: > A bundle list, either advertised by a server or given to "git clone > --bundle-uri", may contain relative URIs. They are resolved with > relative_url(), which calls die() when there are more "../" components > than the base can absorb, so one bad entry aborts the whole clone. > > Resolve them with relative_url_gently() instead. When that fails, > bundle_list_update() reports the problem as an error and stops > parsing the list, leaving the bundle without a URI. > > What happens then depends on where the list came from. For a list > advertised by a server, the bundles before the bad entry are still > used and the ones after it are not. A list given to "--bundle-uri" is > read from a file and rejected as a whole. In both cases the clone > carries on and fetches what is missing from the remote. This tells us the story much better than the previous rounds. > This resolves the TODO in t5750, so update the test to match. > > Signed-off-by: Aniket Gupta > --- > bundle-uri.c | 10 +++++++++- > t/t5750-bundle-uri-parse.sh | 15 +++++++-------- > 2 files changed, 16 insertions(+), 9 deletions(-) > > diff --git a/bundle-uri.c b/bundle-uri.c > index 9797eaed9a..d2a33b930f 100644 > --- a/bundle-uri.c > +++ b/bundle-uri.c > @@ -209,9 +209,17 @@ static int bundle_list_update(const char *key, const char *value, > strbuf_release(&id); > > if (!strcmp(subkey, "uri")) { > + struct strbuf err = STRBUF_INIT; > + > if (bundle->uri) > return -1; > - bundle->uri = relative_url(list->baseURI, value, NULL); > + bundle->uri = relative_url_gently(list->baseURI, value, NULL, > + &err); > + if (!bundle->uri) { > + error("%s", err.buf); > + strbuf_release(&err); > + return -1; > + } > return 0; > } This is minor, but because bundle_list_update() places the bundle in the '.bundles' hashmap of 'list' before we come here, a failing entry will stay in the hashmap with '.uri' of 'bundle' set to NULL. If valid bundles precede a bad entry, fetch_bundle_uri_internal() may emit a "error: bundle '' has no uri" while iterating over '.bundles' of 'list' before the clone proceeds with the remote fetch, which may or may not be what we want. After all, we have already issued an error message, so...? Thanks.