Skip to content

Conversation

hickford
Copy link

@hickford hickford commented Sep 30, 2025

@hickford hickford force-pushed the url-prefix branch 2 times, most recently from ea4aace to 1894200 Compare October 1, 2025 19:53
Documentation was inaccurate since 9a121b0 (credential: handle
`credential.<partial-URL>.<key>` again, 2020-04-24)

Add tests for documented behaviour.

Signed-off-by: M Hickford <[email protected]>
@hickford
Copy link
Author

hickford commented Oct 1, 2025

/submit

Copy link

gitgitgadget bot commented Oct 1, 2025

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1979/hickford/url-prefix-v1

To fetch this version to local tag pr-1979/hickford/url-prefix-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1979/hickford/url-prefix-v1

Copy link

gitgitgadget bot commented Oct 1, 2025

On the Git mailing list, "brian m. carlson" wrote (reply to this):

On 2025-10-01 at 20:56:49, M Hickford via GitGitGadget wrote:
> diff --git a/Documentation/gitcredentials.adoc b/Documentation/gitcredentials.adoc
> index 3337bb475d..60c2cc4ade 100644
> --- a/Documentation/gitcredentials.adoc
> +++ b/Documentation/gitcredentials.adoc
> @@ -150,9 +150,8 @@ pattern in the config file. For example, if you have this in your config file:
>  	username = foo
>  --------------------------------------
>  
> -then we will match: both protocols are the same, both hosts are the same, and
> -the "pattern" URL does not care about the path component at all. However, this
> -context would not match:
> +then we will match: both protocols are the same and both hosts are the same.
> +However, this context would not match:
>  
>  --------------------------------------
>  [credential "https://kernel.org"]
> @@ -166,11 +165,11 @@ match: Git compares the protocols exactly.  However, you may use wildcards in
>  the domain name and other pattern matching techniques as with the `http.<URL>.*`
>  options.
>  
> -If the "pattern" URL does include a path component, then this too must match
> -exactly: the context `https://example.com/bar/baz.git` will match a config
> -entry for `https://example.com/bar/baz.git` (in addition to matching the config
> -entry for `https://example.com`) but will not match a config entry for
> -`https://example.com/bar`.
> +If the "pattern" URL does include a path component, then this must match
> +as a prefix path: the context `https://example.com/bar` will match a config
> +entry for `https://example.com/bar/baz.git` but will not match a config entry for
> +`https://example.com/other/repo.git` or `https://example.com/barry/repo.git`
> +(even though it is a string prefix).

This looks like a good description.

>  CONFIGURATION OPTIONS
> diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
> index cb3a85c7ff..07aa834d33 100755
> --- a/t/t0300-credentials.sh
> +++ b/t/t0300-credentials.sh
> @@ -991,18 +991,24 @@ test_expect_success 'url parser not confused by encoded markers' '
>  
>  test_expect_success 'credential config with partial URLs' '
>  	echo "echo password=yep" | write_script git-credential-yep &&
> -	test_write_lines url=https://[email protected]/repo.git >stdin &&
> +	test_write_lines url=https://[email protected]/org/repo.git >stdin &&
>  	for partial in \
>  		example.com \
> +		example.com/org/repo.git \
>  		[email protected] \
> +		[email protected]/org/repo.git \
>  		https:// \
>  		https://example.com \
>  		https://example.com/ \
> +		https://example.com/org \
> +		https://example.com/org/ \
> +		https://example.com/org/repo.git \
>  		https://[email protected] \
>  		https://[email protected]/ \
> -		https://example.com/repo.git \
> -		https://[email protected]/repo.git \
> -		/repo.git
> +		https://[email protected]/org \
> +		https://[email protected]/org/ \
> +		https://[email protected]/org/repo.git \
> +		/org/repo.git
>  	do
>  		git -c credential.$partial.helper=yep \
>  			credential fill <stdin >stdout &&
> @@ -1012,7 +1018,12 @@ test_expect_success 'credential config with partial URLs' '
>  
>  	for partial in \
>  		dont.use.this \
> +		example.com/o \
> +		[email protected]/o \
>  		http:// \
> +		https://example.com/o \
> +		https://[email protected]/o \
> +		/o \
>  		/repo
>  	do
>  		git -c credential.$partial.helper=yep \

I appreciate the additional tests here.
-- 
brian m. carlson (they/them)
Toronto, Ontario, CA

Copy link

gitgitgadget bot commented Oct 2, 2025

This branch is now known as mh/doc-credential-url-prefix.

Copy link

gitgitgadget bot commented Oct 2, 2025

This patch series was integrated into seen via git@fd69138.

Copy link

gitgitgadget bot commented Oct 2, 2025

This patch series was integrated into next via git@dd0d9a1.

Copy link

gitgitgadget bot commented Oct 3, 2025

This patch series was integrated into seen via git@f442740.

@hickford
Copy link
Author

hickford commented Oct 3, 2025

/submit

Copy link

gitgitgadget bot commented Oct 3, 2025

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-1979/hickford/url-prefix-v2

To fetch this version to local tag pr-1979/hickford/url-prefix-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-1979/hickford/url-prefix-v2

Copy link

gitgitgadget bot commented Oct 3, 2025

On the Git mailing list, Junio C Hamano wrote (reply to this):

"M Hickford via GitGitGadget" <[email protected]> writes:

> From: M Hickford <[email protected]>
>
> Documentation was inaccurate since 9a121b0d226 (credential: handle
> `credential.<partial-URL>.<key>` again, 2020-04-24)
>
> Add tests for documented behaviour.
>
> Signed-off-by: M Hickford <[email protected]>
> ---
>     docs/gitcredentials: describe URL prefix matching

Hmph, v1 was merged to 'next' already yesterday, so a replacement
patch is not what I was expecting to see.  Can you make an
incremental update instead?

Thanks.

@hickford hickford force-pushed the url-prefix branch 2 times, most recently from 26d5f2c to af50990 Compare October 4, 2025 12:54
Record that path prefix matching requires the pattern to also include
protocol and host.

Signed-off-by: M Hickford <[email protected]>
Copy link

gitgitgadget bot commented Oct 5, 2025

This patch series was integrated into seen via git@ea698f0.

Copy link

gitgitgadget bot commented Oct 6, 2025

This patch series was integrated into seen via git@af1c302.

Copy link

gitgitgadget bot commented Oct 6, 2025

There was a status update in the "Cooking" section about the branch mh/doc-credential-url-prefix on the Git mailing list:

Doc update to describe a feature that has already been implemented.

Will merge to 'master'.
source: <[email protected]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant