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-submodule-update.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-submodule-update.sh')
| -rw-r--r-- | t/lib-submodule-update.sh | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index 2d31fcfda1..dee14992c5 100644 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -168,20 +168,16 @@ replace_gitfile_with_git_dir () { # Note that this only supports submodules at the root level of the # superproject, with the default name, i.e. same as its path. test_git_directory_is_unchanged () { - ( - cd ".git/modules/$1" && - # does core.worktree point at the right place? - test "$(git config core.worktree)" = "../../../$1" && - # remove it temporarily before comparing, as - # "$1/.git/config" lacks it... - git config --unset core.worktree - ) && + # does core.worktree point at the right place? + echo "../../../$1" >expect && + git -C ".git/modules/$1" config core.worktree >actual && + test_cmp expect actual && + # remove it temporarily before comparing, as + # "$1/.git/config" lacks it... + git -C ".git/modules/$1" config --unset core.worktree && diff -r ".git/modules/$1" "$1/.git" && - ( - # ... and then restore. - cd ".git/modules/$1" && - git config core.worktree "../../../$1" - ) + # ... and then restore. + git -C ".git/modules/$1" config core.worktree "../../../$1" } test_git_directory_exists () { @@ -189,7 +185,9 @@ test_git_directory_exists () { if test -f sub1/.git then # does core.worktree point at the right place? - test "$(git -C .git/modules/$1 config core.worktree)" = "../../../$1" + echo "../../../$1" >expect && + git -C ".git/modules/$1" config core.worktree >actual && + test_cmp expect actual fi } |
