]> git.ipfire.org Git - thirdparty/git.git/commit - t/t1300-config.sh
config: "git config --get-urlmatch" parses section.<url>.key
authorJunio C Hamano <gitster@pobox.com>
Wed, 31 Jul 2013 18:14:59 +0000 (11:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 5 Aug 2013 23:02:28 +0000 (16:02 -0700)
commitd4770964d5058a679ebfc051acceb7968a831f84
treeb8b8f9d8534f0b1f5b8e728b5e798bd561194cf4
parentd9b9169b3419edb0fa7a787ec1641ee75397f2a4
config: "git config --get-urlmatch" parses section.<url>.key

Using the same urlmatch_config_entry() infrastructure, add a new
mode "--get-urlmatch" to the "git config" command, to learn values
for the "virtual" two-level variables customized for the specific
URL.

    git config [--<type>] --get-urlmatch <section>[.<key>] <url>

With <section>.<key> fully specified, the configuration data for
<section>.<urlpattern>.<key> for <urlpattern> that best matches the
given <url> is sought (and if not found, <section>.<key> is used)
and reported.  For example, with this configuration:

    [http]
        sslVerify
    [http "https://weak.example.com"]
        cookieFile = /tmp/cookie.txt
        sslVerify = false

You would get

    $ git config --bool --get-urlmatch http.sslVerify https://good.example.com
    true
    $ git config --bool --get-urlmatch http.sslVerify https://weak.example.com
    false

With only <section> specified, you can get a list of all variables
in the section with their values that apply to the given URL.  E.g

    $ git config --get-urlmatch http https://weak.example.com
    http.cookiefile /tmp/cookie.txt
    http.sslverify false

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-config.txt
builtin/config.c
t/t1300-repo-config.sh