t4046: avoid continue in &&-chain for zsh
commit058b8dc2c2467c507d7b984b838e6c779107d6db
authorbrian m. carlson <sandals@crustytoothpaste.net>
Fri, 26 Apr 2024 22:11:53 +0000 (26 22:11 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Apr 2024 23:31:46 +0000 (26 16:31 -0700)
tree272068fd52df47ba2ff3c7fc766a1c7b8b774b8b
parentbf995e7a4f94a9388aa8042dc9e338f3fcb75496
t4046: avoid continue in &&-chain for zsh

zsh has a bug in which the keyword "continue" within an &&-chain is not
effective and the code following it is executed nonetheless.
Fortunately, this bug has been fixed upstream in 12e5db145 ("51608:
Don't execute commands after "continue &&"", 2023-03-29).  However, zsh
releases very infrequently, so it is not present in a stable release
yet.

That, combined with the fact that almost all zsh users get their shell
from their OS vendor, means that it will likely be a long time before
this problem is fixed for most users.  We have other workarounds in
place for FreeBSD ash and dash, so it shouldn't be too difficult to add
one here, either.

Replace the existing code with a test and if-block, which comes only at
the cost of an additional indentation, and leaves the code a little more
idiomatic anyway.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4046-diff-unmerged.sh