diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2023-02-06 23:44:31 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-07 00:30:42 +0100 |
commit | 4bd0785dc2eb7b3f23d25c8013337cc51ab1065d (patch) | |
tree | 212e0867573fcb4b7db80ebb649a046a9b80fab8 /t/t0100-previous.sh | |
parent | tests: don't lose "git" exit codes in "! ( git ... | grep )" (diff) | |
download | git-4bd0785dc2eb7b3f23d25c8013337cc51ab1065d.tar.xz git-4bd0785dc2eb7b3f23d25c8013337cc51ab1065d.zip |
tests: don't lose exit status with "test <op> $(git ...)"
As with the preceding commit, rewrite tests that ran "git" inside
command substitution and lost the exit status of "git" so that we
notice the failing "git". This time around we're converting cases that
didn't involve a containing sub-shell around the command substitution.
In the case of "t0060-path-utils.sh" and
"t2005-checkout-index-symlinks.sh" convert the relevant code to using
the modern style of indentation and newline wrapping while having to
change it.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0100-previous.sh')
-rwxr-xr-x | t/t0100-previous.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/t/t0100-previous.sh b/t/t0100-previous.sh index a16cc3d298..70a3223f21 100755 --- a/t/t0100-previous.sh +++ b/t/t0100-previous.sh @@ -12,7 +12,9 @@ test_expect_success 'branch -d @{-1}' ' test_commit A && git checkout -b junk && git checkout - && - test "$(git symbolic-ref HEAD)" = refs/heads/main && + echo refs/heads/main >expect && + git symbolic-ref HEAD >actual && + test_cmp expect actual && git branch -d @{-1} && test_must_fail git rev-parse --verify refs/heads/junk ' @@ -21,7 +23,9 @@ test_expect_success 'branch -d @{-12} when there is not enough switches yet' ' git reflog expire --expire=now && git checkout -b junk2 && git checkout - && - test "$(git symbolic-ref HEAD)" = refs/heads/main && + echo refs/heads/main >expect && + git symbolic-ref HEAD >actual && + test_cmp expect actual && test_must_fail git branch -d @{-12} && git rev-parse --verify refs/heads/main ' |