From: Junio C Hamano <gitster@pobox.com>
To: Aniket Gupta <aniketgupta3001@gmail.com>
Cc: git@vger.kernel.org, Derrick Stolee <stolee@gmail.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v4 3/3] bundle-uri: do not die on unresolvable relative URIs
Date: Mon, 23 Nov 2026 13:04:03 -0800 [thread overview]
Message-ID: <xmqq1p8b5kfw.fsf@gitster.g> (raw)
In-Reply-To: <ce37d9588d833d306df3cc9d0e656e09c32e6b44.1795415793.git.aniketgupta3001@gmail.com> (Aniket Gupta's message of "Mon, 23 Nov 2026 12:14:22 +0530")
Aniket Gupta <aniketgupta3001@gmail.com> 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 <aniketgupta3001@gmail.com>
> ---
> 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 '<id>' 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.
next prev parent reply other threads:[~2026-11-23 21:04 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 15:28 [PATCH v3 0/3] bundle-uri: do not die on unresolvable relative URIs Aniket Gupta
2026-11-05 15:28 ` [PATCH v3 1/3] remote: add relative_url_gently() Aniket Gupta
2026-11-06 14:36 ` Derrick Stolee
2026-11-05 15:28 ` [PATCH v3 2/3] remote: do not show credentials when relative_url() fails Aniket Gupta
2026-11-06 14:43 ` Derrick Stolee
2026-11-06 19:15 ` Junio C Hamano
2026-11-09 10:39 ` Aniket Gupta
2026-11-05 15:28 ` [PATCH v3 3/3] bundle-uri: do not die on unresolvable relative URIs Aniket Gupta
2026-11-06 14:51 ` Derrick Stolee
2026-11-06 14:57 ` [PATCH v3 0/3] " Derrick Stolee
2026-11-06 17:25 ` Aniket Gupta
2026-11-09 9:26 ` Patrick Steinhardt
2026-11-09 10:56 ` Aniket Gupta
2026-11-23 6:44 ` [PATCH v4 " Aniket Gupta
2026-11-23 6:44 ` [PATCH v4 1/3] remote: add relative_url_gently() Aniket Gupta
2026-11-23 6:44 ` [PATCH v4 2/3] remote: name the original URL when relative_url() fails Aniket Gupta
2026-11-23 6:44 ` [PATCH v4 3/3] bundle-uri: do not die on unresolvable relative URIs Aniket Gupta
2026-11-23 21:04 ` Junio C Hamano [this message]
2026-11-23 22:25 ` Aniket Gupta
2026-11-23 14:54 ` [PATCH v4 0/3] " Derrick Stolee
2026-11-26 11:58 ` [PATCH v5 " Aniket Gupta
2026-11-26 11:58 ` [PATCH v5 1/3] remote: add relative_url_gently() Aniket Gupta
2026-11-26 11:58 ` [PATCH v5 2/3] remote: name the original URL when relative_url() fails Aniket Gupta
2026-11-26 11:58 ` [PATCH v5 3/3] bundle-uri: do not die on unresolvable relative URIs Aniket Gupta
2026-11-30 19:11 ` Derrick Stolee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1p8b5kfw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=aniketgupta3001@gmail.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox