summaryrefslogtreecommitdiff
path: root/Documentation/gitcredentials.txt
diff options
context:
space:
mode:
authorLibravatar brian m. carlson <bk2204@github.com>2020-02-20 02:24:13 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-02-20 13:05:43 -0800
commit46fd7b390034eb5dde6a3f955e677c5260e4d10c (patch)
treea35d6bf10ad09e279feca361865251072a04123f /Documentation/gitcredentials.txt
parentcredential: use the last matching username in the config (diff)
downloadtgif-46fd7b390034eb5dde6a3f955e677c5260e4d10c.tar.xz
credential: allow wildcard patterns when matching config
In some cases, a user will want to use a specific credential helper for a wildcard pattern, such as https://*.corp.example.com. We have code that handles this already with the urlmatch code, so let's use that instead of our custom code. Since the urlmatch code is a superset of our current matching in terms of capabilities, there shouldn't be any cases of things that matched previously that don't match now. However, in addition to wildcard matching, we now use partial path matching, which can cause slightly different behavior in the case that a helper applies to the prefix (considering path components) of the remote URL. While different, this is probably the behavior people were wanting anyway. Since we're using the urlmatch code, we need to encode the components we've gotten into a URL to match, so add a function to percent-encode data and format the URL with it. We now also no longer need to the custom code to match URLs, so let's remove it. Additionally, the urlmatch code always looks for the best match, whereas we want all matches for credential helpers to preserve existing behavior. Let's add an optional field, select_fn, that lets us control which items we want (in this case, all of them) and default it to the best-match code that already exists for other users. Signed-off-by: brian m. carlson <bk2204@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/gitcredentials.txt')
-rw-r--r--Documentation/gitcredentials.txt4
1 files changed, 3 insertions, 1 deletions
diff --git a/Documentation/gitcredentials.txt b/Documentation/gitcredentials.txt
index ea759fdee5..12cb032352 100644
--- a/Documentation/gitcredentials.txt
+++ b/Documentation/gitcredentials.txt
@@ -131,7 +131,9 @@ context would not match:
because the hostnames differ. Nor would it match `foo.example.com`; Git
compares hostnames exactly, without considering whether two hosts are part of
the same domain. Likewise, a config entry for `http://example.com` would not
-match: Git compares the protocols exactly.
+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