Re: [PATCH v2] tests: set temp variables using 'env' in test function instead of subshell

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

 



Jeff King <peff@xxxxxxxx> writes:

> On Tue, Mar 18, 2014 at 01:37:39PM -0700, Junio C Hamano wrote:
>
>> > diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
>> > index c9c426c..3e3f77b 100755
>> > --- a/t/t1300-repo-config.sh
>> > +++ b/t/t1300-repo-config.sh
>> > @@ -974,24 +974,15 @@ test_expect_success SYMLINKS 'symlinked configuration' '
>> >  '
>> >
>> >  test_expect_success 'nonexistent configuration' '
>> > -	(
>> > -		GIT_CONFIG=doesnotexist &&
>> > -		export GIT_CONFIG &&
>> > -		test_must_fail git config --list &&
>> > -		test_must_fail git config test.xyzzy
>> > -	)
>> > +	test_must_fail env GIT_CONFIG=doesnotexist git config --list &&
>> > +	test_must_fail env GIT_CONFIG=doesnotexist git config test.xyzzy
>> >  '
>
> Isn't GIT_CONFIG here another way of saying:
>
>   test_must_fail git config -f doesnotexist --list
>
> Perhaps that is shorter and more readable still (and there are a few
> similar cases in this patch.

Surely, but are we assuming that "git config" correctly honors the
equivalence between GIT_CONFIG=file and -f file, or is that also
something we are testing in these tests?

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]