Re: [PATCH] tests: set temp variables using 'env' in test function instead of subshell
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 17, 2014, 20:57 UTC
- Message-ID
- <xmqqeh20czl9.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1395046593-4057-1-git-send-email-unsignedzero@gmail.com>
David Tran <unsignedzero@gmail.com> 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.
Show 8 quoted lines
> 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 ;-)?
Show 6 quoted lines
> 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.
Show 9 quoted lines
> @@ -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.