diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-06 23:44:30 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-06 15:30:41 -0800 |
commit | 0cd1a8818db35df70c88d7864682146bf4fa8227 (patch) | |
tree | ea5b5a54e19053d5a44f436452f6e607c4585e24 /t/t3200-branch.sh | |
parent | 62f3a45bb49f9436f1cd754b02ac549b1f6514cf (diff) | |
download | git-0cd1a8818db35df70c88d7864682146bf4fa8227.tar.gz |
tests: don't lose exit status with "(cd ...; test <op> $(git ...))"
Rewrite tests that ran "git" inside command substitution and lost the
exit status of "git" so that we notice the failing "git".
Have them use modern patterns such as a "test_cmp" of the expected
outputs instead.
We'll fix more of these these in the subsequent commit, for now we're
only converting the cases where this loss of exit code was combined
with spawning a sub-shell.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-x | t/t3200-branch.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 5a169b68d6..5a8a48287c 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -245,9 +245,13 @@ test_expect_success 'git branch -M baz bam should succeed within a worktree in w ( cd bazdir && git branch -M baz bam && - test $(git rev-parse --abbrev-ref HEAD) = bam + echo bam >expect && + git rev-parse --abbrev-ref HEAD >actual && + test_cmp expect actual ) && - test $(git rev-parse --abbrev-ref HEAD) = bam && + echo bam >expect && + git rev-parse --abbrev-ref HEAD >actual && + test_cmp expect actual && rm -r bazdir && git worktree prune ' |