]> git.ipfire.org Git - thirdparty/git.git/commit - urlmatch.c
urlmatch: allow globbing for the URL host part
authorPatrick Steinhardt <patrick.steinhardt@elego.de>
Tue, 31 Jan 2017 09:01:47 +0000 (10:01 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Feb 2017 21:22:50 +0000 (13:22 -0800)
commita272b9e70a48a355b6dd7ff0179c11f8da7ef0f3
tree969e517781e74bbecbcb04e2b138fb68fbc150ce
parentaf99049ca92f5a5d16d8cce9727b859ac5c9ee00
urlmatch: allow globbing for the URL host part

The URL matching function computes for two URLs whether they match not.
The match is performed by splitting up the URL into different parts and
then doing an exact comparison with the to-be-matched URL.

The main user of `urlmatch` is the configuration subsystem. It allows to
set certain configurations based on the URL which is being connected to
via keys like `http.<url>.*`. A common use case for this is to set
proxies for only some remotes which match the given URL. Unfortunately,
having exact matches for all parts of the URL can become quite tedious
in some setups. Imagine for example a corporate network where there are
dozens or even hundreds of subdomains, which would have to be configured
individually.

Allow users to write an asterisk '*' in place of any 'host' or
'subdomain' label as part of the host name.  For example,
"http.https://*.example.com.proxy" sets "http.proxy" for all direct
subdomains of "https://example.com", e.g. "https://foo.example.com", but
not "https://foo.bar.example.com".

Signed-off-by: Patrick Steinhardt <patrick.steinhardt@elego.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
t/t1300-repo-config.sh
urlmatch.c