Re: [PATCH v3 06/12] builtin/config.c: test misuse of format_config()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Glen Choo via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

> From: Glen Choo <chooglen@xxxxxxxxxx>
>
> current_config_*() functions aren't meant to be called outside of
> config callbacks because they read state that is only set when iterating
> through config.

Interesting.  And config_context is about expressing the state of
the iteration, so presumably some of these callers that do not have
config_context to pass (because they happen outside iterations) will
now (can|have to) pass NULL or something to say "I am asking format
but from outside any iteration" or something?

> +test_expect_success 'urlmatch with --show-scope' '
> +	cat >.git/config <<-\EOF &&
> +	[http "https://weak.example.com";]
> +		sslVerify = false
> +		cookieFile = /tmp/cookie.txt
> +	EOF
> +
> +	cat >expect <<-EOF &&
> +	unknown	http.cookiefile /tmp/cookie.txt
> +	unknown	http.sslverify false
> +	EOF
> +	git config --get-urlmatch --show-scope HTTP https://weak.example.com >actual &&
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'urlmatch favors more specific URLs' '
>  	cat >.git/config <<-\EOF &&
>  	[http "https://example.com/";]
> @@ -2055,6 +2070,10 @@ test_expect_success '--show-origin blob ref' '
>  	test_cmp expect output
>  '
>  
> +test_expect_success '--show-origin with --default' '
> +	test_must_fail git config --show-origin --default foo some.key
> +'
> +
>  test_expect_success '--show-scope with --list' '
>  	cat >expect <<-EOF &&
>  	global	user.global=true
> @@ -2123,6 +2142,12 @@ test_expect_success '--show-scope with --show-origin' '
>  	test_cmp expect output
>  '
>  
> +test_expect_success '--show-scope with --default' '
> +	git config --show-scope --default foo some.key >actual &&
> +	echo "unknown	foo" >expect &&
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'override global and system config' '
>  	test_when_finished rm -f \"\$HOME\"/.gitconfig &&
>  	cat >"$HOME"/.gitconfig <<-EOF &&



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux