diff options
| author | Junio C Hamano <gitster@pobox.com> | 2023-03-19 15:03:10 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-03-19 15:03:10 -0700 |
| commit | 6f54213718ccd05be8a07f74d0d4e524ebccb3be (patch) | |
| tree | 92d0218f9b7f7d4eaa9ecf1c34ad1b6f1fa54777 /t/lib-patch-mode.sh | |
| parent | Start the 2.41 cycle (diff) | |
| parent | tests: don't lose misc "git" exit codes (diff) | |
| download | git-6f54213718ccd05be8a07f74d0d4e524ebccb3be.tar.gz git-6f54213718ccd05be8a07f74d0d4e524ebccb3be.zip | |
Merge branch 'ab/avoid-losing-exit-codes-in-tests'
Test clean-up.
* ab/avoid-losing-exit-codes-in-tests:
tests: don't lose misc "git" exit codes
tests: don't lose exit status with "test <op> $(git ...)"
tests: don't lose "git" exit codes in "! ( git ... | grep )"
tests: don't lose exit status with "(cd ...; test <op> $(git ...))"
t/lib-patch-mode.sh: fix ignored exit codes
auto-crlf tests: don't lose exit code in loops and outside tests
Diffstat (limited to 't/lib-patch-mode.sh')
| -rw-r--r-- | t/lib-patch-mode.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/t/lib-patch-mode.sh b/t/lib-patch-mode.sh index cfd76bf987..89ca1f7805 100644 --- a/t/lib-patch-mode.sh +++ b/t/lib-patch-mode.sh @@ -29,8 +29,12 @@ set_and_save_state () { # verify_state <path> <expected-worktree-content> <expected-index-content> verify_state () { - test "$(cat "$1")" = "$2" && - test "$(git show :"$1")" = "$3" + echo "$2" >expect && + test_cmp expect "$1" && + + echo "$3" >expect && + git show :"$1" >actual && + test_cmp expect actual } # verify_saved_state <path> @@ -46,5 +50,6 @@ save_head () { } verify_saved_head () { - test "$(cat _head)" = "$(git rev-parse HEAD)" + git rev-parse HEAD >actual && + test_cmp _head actual } |
