{"thread":{"id":"44009","subject":"[PATCH] t9903: fix broken && chain","startedAt":"2016-09-05T19:00:55Z","lastAt":"2016-09-07T18:35:52Z","messageCount":3,"participants":["Johannes Sixt","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"301108","messageId":"61de943c-df93-58e9-ca48-c469a71a1d43@kdbg.org","threadId":"44009","inReplyTo":null,"subject":"[PATCH] t9903: fix broken && chain","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-09-05T19:00:47Z","receivedAt":"2016-09-05T19:00:55Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"We might wonder why our && chain check does not catch this case:\nThe && chain check uses a strange exit code with the expectation that\nthe second or later part of a broken && chain would not exit with this\nparticular code.\n\nThis expectation does not work in this case because __git_ps1, being\nthe first command in the second part of the broken && chain, records\nthe current exit code, does its work, and finally returns to the caller\nwith the recorded exit code. This fools our && chain check.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n  t/t9903-bash-prompt.sh | 2 +-\n  1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\nindex 0db4469..97c9b32 100755\n--- a/t/t9903-bash-prompt.sh\n+++ b/t/t9903-bash-prompt.sh\n@@ -177,7 +177,7 @@ test_expect_success 'prompt - interactive rebase' '\n  \tgit checkout b1 &&\n  \ttest_when_finished \"git checkout master\" &&\n  \tgit rebase -i HEAD^ &&\n-\ttest_when_finished \"git rebase --abort\"\n+\ttest_when_finished \"git rebase --abort\" &&\n  \t__git_ps1 >\"$actual\" &&\n  \ttest_cmp expected \"$actual\"\n  '\n-- \n2.10.0.85.gea34e30\n"},{"id":"301171","messageId":"20160906071507.pmbpsjoo4me3o6za@sigill.intra.peff.net","threadId":"44009","inReplyTo":"61de943c-df93-58e9-ca48-c469a71a1d43@kdbg.org","subject":"Re: [PATCH] t9903: fix broken && chain","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2016-09-06T07:15:07Z","receivedAt":"2016-09-06T07:15:14Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Sep 05, 2016 at 09:00:47PM +0200, Johannes Sixt wrote:\n\n> We might wonder why our && chain check does not catch this case:\n> The && chain check uses a strange exit code with the expectation that\n> the second or later part of a broken && chain would not exit with this\n> particular code.\n> \n> This expectation does not work in this case because __git_ps1, being\n> the first command in the second part of the broken && chain, records\n> the current exit code, does its work, and finally returns to the caller\n> with the recorded exit code. This fools our && chain check.\n\nWow. Good find. Patch itself is obviously correct.\n\n-Peff\n"},{"id":"301309","messageId":"xmqqbmzzmubj.fsf@gitster.mtv.corp.google.com","threadId":"44009","inReplyTo":"61de943c-df93-58e9-ca48-c469a71a1d43@kdbg.org","subject":"Re: [PATCH] t9903: fix broken && chain","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-07T18:35:44Z","receivedAt":"2016-09-07T18:35:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> We might wonder why our && chain check does not catch this case:\n> The && chain check uses a strange exit code with the expectation that\n> the second or later part of a broken && chain would not exit with this\n> particular code.\n>\n> This expectation does not work in this case because __git_ps1, being\n> the first command in the second part of the broken && chain, records\n> the current exit code, does its work, and finally returns to the caller\n> with the recorded exit code. This fools our && chain check.\n>\n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n>  t/t9903-bash-prompt.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh\n> index 0db4469..97c9b32 100755\n> --- a/t/t9903-bash-prompt.sh\n> +++ b/t/t9903-bash-prompt.sh\n> @@ -177,7 +177,7 @@ test_expect_success 'prompt - interactive rebase' '\n>  \tgit checkout b1 &&\n>  \ttest_when_finished \"git checkout master\" &&\n>  \tgit rebase -i HEAD^ &&\n> -\ttest_when_finished \"git rebase --abort\"\n> +\ttest_when_finished \"git rebase --abort\" &&\n>  \t__git_ps1 >\"$actual\" &&\n>  \ttest_cmp expected \"$actual\"\n>  '\n\nThanks.\n"}]}