]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t2407: fix broken &&-chains in compound statement
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 22 Aug 2022 18:26:40 +0000 (18:26 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Aug 2022 19:53:02 +0000 (12:53 -0700)
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>
t/t2407-worktree-heads.sh

index 50815acd3e879554640d8f2ecf2111b4d73b7610..019a40df2ca99480c547910026bf97102d54a23c 100755 (executable)
@@ -41,10 +41,10 @@ test_expect_success 'setup' '
 test_expect_success 'refuse to overwrite: checked out in worktree' '
        for i in 1 2 3 4
        do
-               test_must_fail git branch -f wt-$i HEAD 2>err
+               test_must_fail git branch -f wt-$i HEAD 2>err &&
                grep "cannot force update the branch" err &&
 
-               test_must_fail git branch -D wt-$i 2>err
+               test_must_fail git branch -D wt-$i 2>err &&
                grep "Cannot delete branch" err || return 1
        done
 '