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

From: Junio C Hamano <[email-masked]>
Date: Mon, 17 Mar 2014 13:57:54 -0700

David Tran <[email-masked]> writes:

> Fixed the broken &&-chain and the tests run correctly. The double env is
> fixed to be a single env. The useless subshells are removed.
> ...

Hmph.

>  test_expect_success 'need valid notes ref' '
> -	(MSG=1 GIT_NOTES_REF=/ && export MSG GIT_NOTES_REF &&
> -	 test_must_fail git notes add) &&
> -	(MSG=2 GIT_NOTES_REF=/ && export MSG GIT_NOTES_REF &&
> -	 test_must_fail git notes show)
> +	test_must_fail env MSG=1 env GIT_NOTES_REF=/ git notes show &&
> +	test_must_fail env MSG=2 env GIT_NOTES_REF=/ git notes show
>  '

Oh, really ;-)?

>  test_expect_success 'refusing to add notes in refs/heads/' '
> -	(MSG=1 GIT_NOTES_REF=refs/heads/bogus &&
> -	 export MSG GIT_NOTES_REF &&
> -	 test_must_fail git notes add)
> +	test_must_fail env MSG=1 GIT_NOTES_REF=refs/heads/bogus git notes add
>  '

This one is good.

> @@ -529,9 +510,7 @@ test_expect_success 'aborted --continue does not squash commits after "edit"' '
>  	echo "edited again" > file7 &&
>  	git add file7 &&
>  	(
> -		FAKE_COMMIT_MESSAGE=" " &&
> -		export FAKE_COMMIT_MESSAGE &&
> -		test_must_fail git rebase --continue
> +		test_must_fail env FAKE_COMMIT_MESSAGE=" " git rebase --continue
>  	) &&

Do we do anything to cause us misbehave if the above is done outside
the subshell?

Thanks.  Getting closer, I think.