Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Aniket Gupta <aniketgupta3001@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH v2] bundle-uri: do not die on unresolvable relative URIs
Date: Thu, 5 Nov 2026 14:43:12 +0100	[thread overview]
Message-ID: <auyH8BGzIsipPAJG@pks.im> (raw)
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.

> 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?

> 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

  reply	other threads:[~2026-11-05 13:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 11:58 [PATCH] bundle-uri: do not die on unresolvable relative URIs Aniket Gupta
2026-11-03 13:04 ` Patrick Steinhardt
2026-11-03 15:55   ` Aniket Gupta
2026-11-03 15:52 ` [PATCH v2] " Aniket Gupta
2026-11-05 13:43   ` Patrick Steinhardt [this message]
2026-11-05 15:29     ` Aniket Gupta

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=auyH8BGzIsipPAJG@pks.im \
    --to=ps@pks.im \
    --cc=aniketgupta3001@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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