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

Re: [PATCH v2] bundle-uri: do not die on unresolvable relative URIs

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 5, 2026, 13:43 UTC
Message-ID
<auyH8BGzIsipPAJG@pks.im>
In-Reply-To
<20261103155231.381-1-aniketgupta3001@gmail.com>
On Tue, Nov 03, 2026 at 03:52:31PM +0000, Aniket Gupta wrote:
> A bundle list, either advertised by a server or given to "git clone
> --bundle-uri", may contain relative URIs. relative_url() resolves them
> and calls die() when there are more "../" components than the base can
> absorb, so one bad entry aborts the whole clone.
Thanks, this gives much better context now compared to v1.
> Add relative_url_gently() which returns NULL and records the reason in
> a strbuf instead of dying. relative_url() keeps dying, so the submodule
> callers are unchanged.

This sentence is weird as it adds context that doesn't make sense standalone. You wouldn't know that there are submodule callers, so why do you suddenly make the jump talking about them? And it immediately makes you wonder about other callers.

Saying something like "relative_url() is now a thin wrapper around that new function that continues to die, so existing callers continue to behave the same" would be way less surprising.

Show 6 quoted lines
> bundle_list_update() reports the problem as an error and leaves the
> bundle without a URI. The download code already skips such a bundle,
> so the clone carries on with the others.
> 
> Name the URL in the error message, without any credentials, and update
> the tests.
Would it have made sense to split this out into a separate commit?
Show 14 quoted lines
> diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
> index 56faf5fe73..50cc37bc98 100755
> --- a/t/t0060-path-utils.sh
> +++ b/t/t0060-path-utils.sh
> @@ -394,6 +394,13 @@ test_submodule_relative_url "../" "$(pwd)/addtest" "../repo" "$(pwd)/repo"
>  test_submodule_relative_url "../" "foo/bar" "../submodule" "../foo/submodule"
>  test_submodule_relative_url "../" "foo" "../submodule" "../submodule"
>  
> +test_expect_success 'relative_url() does not show credentials when it fails' '
> +	test_must_fail test-tool submodule resolve-relative-url "" \
> +		"https://user:secret@host.example/a" ../../../../../../x 2>err &&
> +	test_grep "cannot strip one component off url" err &&
> +	test_grep ! secret err
> +'

Wouldn't it make sense in this case to grep for the exact URL printed, as the intent is to verify that we print the correct one? At that point, we can probably just compare the full message.

Patrick
Previous: Aniket GuptaNext: Aniket Gupta
Message 5 of 6 in “bundle-uri: do not die on unresolvable relative URIs”
  1. bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Oct 28, 2026
  2. Patrick SteinhardtNov 3, 2026
  3. Aniket GuptaNov 3, 2026
  4. bundle-uri: do not die on unresolvable relative URIsAniket Gupta, Nov 3, 2026
  5. Patrick SteinhardtNov 5, 2026
  6. Aniket GuptaNov 5, 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.