OSDN Git Service

t9903: fix broken && chain
authorJohannes Sixt <j6t@kdbg.org>
Mon, 5 Sep 2016 19:00:47 +0000 (21:00 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 7 Sep 2016 18:35:08 +0000 (11:35 -0700)
We might wonder why our && chain check does not catch this case:
The && chain check uses a strange exit code with the expectation that
the second or later part of a broken && chain would not exit with this
particular code.

This expectation does not work in this case because __git_ps1, being
the first command in the second part of the broken && chain, records
the current exit code, does its work, and finally returns to the caller
with the recorded exit code. This fools our && chain check.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t9903-bash-prompt.sh

index 0db4469..97c9b32 100755 (executable)
@@ -177,7 +177,7 @@ test_expect_success 'prompt - interactive rebase' '
        git checkout b1 &&
        test_when_finished "git checkout master" &&
        git rebase -i HEAD^ &&
-       test_when_finished "git rebase --abort"
+       test_when_finished "git rebase --abort" &&
        __git_ps1 >"$actual" &&
        test_cmp expected "$actual"
 '