t2407: fix broken &&-chains in compound statement
The breaks in the &&-chain in this test went unnoticed because the "magic exit code 117" &&-chain checker built into test-lib.sh only recognizes broken &&-chains at the top-level; it does not work within `{...}` groups, `(...)` subshells, `$(...)` substitutions, or within bodies of compound statements, such as `if`, `for`, `while`, `case`, etc. Furthermore, `chainlint.sed` detects broken &&-chains only in `(...)` subshells. Thus, the &&-chain breaks in this test fall into the blind spots of the &&-chain linters. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Sunshine committed
Aug 22, 2022 at 18:26 UTC
308cbaa0829f6c039728b521153e63928934681e
1 file changed
+2
-2
t/t2407-worktree-heads.sh
+2
-2
@@ -41,10 +41,10 @@ test_expect_success 'setup' '
41
test_expect_success 'refuse to overwrite: checked out in worktree' '
42
for i in 1 2 3 4
43
do
44
- test_must_fail git branch -f wt-$i HEAD 2>err
44
+ test_must_fail git branch -f wt-$i HEAD 2>err &&
45
grep "cannot force update the branch" err &&
46
47
- test_must_fail git branch -D wt-$i 2>err
47
+ test_must_fail git branch -D wt-$i 2>err &&
48
grep "Cannot delete branch" err || return 1
49
done
50
'