* [PATCH] t9903: fix broken && chain
@ 2016-09-05 19:00 Johannes Sixt
2016-09-06 7:15 ` Jeff King
2016-09-07 18:35 ` Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Johannes Sixt @ 2016-09-05 19:00 UTC (permalink / raw)
To: Git Mailing List
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>
---
t/t9903-bash-prompt.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index 0db4469..97c9b32 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -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"
'
--
2.10.0.85.gea34e30
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] t9903: fix broken && chain
2016-09-05 19:00 [PATCH] t9903: fix broken && chain Johannes Sixt
@ 2016-09-06 7:15 ` Jeff King
2016-09-07 18:35 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2016-09-06 7:15 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Git Mailing List
On Mon, Sep 05, 2016 at 09:00:47PM +0200, Johannes Sixt wrote:
> 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.
Wow. Good find. Patch itself is obviously correct.
-Peff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] t9903: fix broken && chain
2016-09-05 19:00 [PATCH] t9903: fix broken && chain Johannes Sixt
2016-09-06 7:15 ` Jeff King
@ 2016-09-07 18:35 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2016-09-07 18:35 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Git Mailing List
Johannes Sixt <j6t@kdbg.org> writes:
> 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>
> ---
> t/t9903-bash-prompt.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
> index 0db4469..97c9b32 100755
> --- a/t/t9903-bash-prompt.sh
> +++ b/t/t9903-bash-prompt.sh
> @@ -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"
> '
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-07 18:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-05 19:00 [PATCH] t9903: fix broken && chain Johannes Sixt
2016-09-06 7:15 ` Jeff King
2016-09-07 18:35 ` Junio C Hamano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox