Subject: Re: [PATCH v2 2/3] t1300: check stderr for "ignores pairs" tests

From: Junio C Hamano <[email-masked]>
Date: Tue, 18 Apr 2023 11:39:54 -0700

Andrei Rybak <[email-masked]> writes:

> Tests "git config ignores pairs ..." in t1300-config.sh validate that
> "git config" ignores various kinds of supplied pairs of environment
> variables GIT_CONFIG_KEY_* GIT_CONFIG_VALUE_* depending on
> GIT_CONFIG_COUNT.  By "ignores" here we mean that "git config" abides by
> the value of environment variable GIT_CONFIG_COUNT and doesn't use
> key-value pairs outside of the supplied GIT_CONFIG_COUNT when trying to
> produce a value for config key "pair.one".

Correct.

>  	GIT_CONFIG_COUNT=1 \
>  		GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
>  		GIT_CONFIG_KEY_1="pair.two" GIT_CONFIG_VALUE_1="value" \
> -		git config --get-regexp "pair.*" >actual &&
> +		git config --get-regexp "pair.*" >actual 2>error &&
>  	cat >expect <<-EOF &&
>  	pair.one value
>  	EOF
> -	test_cmp expect actual
> +	test_cmp expect actual &&
> +	test_must_be_empty error
>  '

Looks good.

>  test_expect_success 'git config ignores pairs with zero count' '
>  	test_must_fail env \
>  		GIT_CONFIG_COUNT=0 GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
> -		git config pair.one >error &&
> +		git config pair.one 2>error &&
>  	test_must_be_empty error
>  '

Looks good too.

>  test_expect_success 'git config ignores pairs with empty count' '
>  	test_must_fail env \
>  		GIT_CONFIG_COUNT= GIT_CONFIG_KEY_0="pair.one" GIT_CONFIG_VALUE_0="value" \
> -		git config pair.one >error &&
> +		git config pair.one 2>error &&
>  	test_must_be_empty error
>  '

Looks good too.

Will queue.  Thanks.