Subject: Re: [PATCH 2/4] Make t1300-repo-config resilient to being run via 'sh -x'

From: Jonathan Nieder <[email-masked]>
Date: Tue, 22 Mar 2016 10:59:48 -0700

Johannes Schindelin wrote:

> --- a/t/t1300-repo-config.sh
> +++ b/t/t1300-repo-config.sh
> @@ -699,17 +699,13 @@ test_expect_success 'invalid unit' '
>  	echo 1auto >expect &&
>  	git config aninvalid.unit >actual &&
>  	test_cmp expect actual &&
> -	cat >expect <<-\EOF &&
> -	fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
> -	EOF
>  	test_must_fail git config --int --get aninvalid.unit 2>actual &&
> -	test_i18ncmp expect actual
> +	grep "^fatal: bad numeric config value .1auto. for .aninvalid.unit. in file .git/config: invalid unit$" actual

Would test_i18ngrep work?

>  '
>  
>  test_expect_success 'invalid stdin config' '
> -	echo "fatal: bad config line 1 in standard input " >expect &&
>  	echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
> -	test_cmp expect output
> +	grep "^fatal: bad config line 1 in standard input $" output

This test is very strange.  Why do we care that it starts with
"fatal:" as opposed to error?  Why are we testing for an extra space at
the end of the line?

I would expect something like

	test_i18ngrep 'line 1 in standard input' output

to be more useful for testing the useful part of the error message while
remaining resilient against error message changes.

Thanks,
Jonathan