Re: [PATCH 6/6] merge hook tests: use 'test_must_fail' instead of '!'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 7, 2014, 00:35 UTC
- Message-ID
- <xmqqk3c6vo9o.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <xmqqiorrvwvh.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 23 quoted lines
> Benoit Pierre <benoit.pierre@gmail.com> writes: > >> Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com> >> --- >> t/t7505-prepare-commit-msg-hook.sh | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t/t7505-prepare-commit-msg-hook.sh >> index 604c06e..1be6cec 100755 >> --- a/t/t7505-prepare-commit-msg-hook.sh >> +++ b/t/t7505-prepare-commit-msg-hook.sh >> @@ -167,7 +167,7 @@ test_expect_success 'with failing hook' ' >> head=`git rev-parse HEAD` && >> echo "more" >> file && >> git add file && >> - ! GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head >> + test_must_fail env GIT_EDITOR="\"\$FAKE_EDITOR\"" git commit -c $head > > Thanks. It is good that you avoided the common pitfall of attempting > > GIT_EDITOR=... test_must_fail git commit -c $head ;# WRONG > > but do we assume everybody has "env"?
It turns out that the answer to this question seems to be "yes, we already do."; so the patch is probably OK as-is.
Thanks.
Show 7 quoted lines
> To be portable, we can do this instead. > > ( > GIT_EDITOR=... && > export GIT_EDITOR && > test_must_fail git commit -c $head > )