Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2023-02-07 01:44:30 +0300
committerJunio C Hamano <gitster@pobox.com>2023-02-07 02:30:41 +0300
commit0cd1a8818db35df70c88d7864682146bf4fa8227 (patch)
treeea5b5a54e19053d5a44f436452f6e607c4585e24 /t/t7402-submodule-rebase.sh
parent62f3a45bb49f9436f1cd754b02ac549b1f6514cf (diff)
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/t7402-submodule-rebase.sh')
-rwxr-xr-xt/t7402-submodule-rebase.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/t/t7402-submodule-rebase.sh b/t/t7402-submodule-rebase.sh
index ebeca12a71..1927a86283 100755
--- a/t/t7402-submodule-rebase.sh
+++ b/t/t7402-submodule-rebase.sh
@@ -82,11 +82,19 @@ test_expect_success 'stash with a dirty submodule' '
CURRENT=$(cd submodule && git rev-parse HEAD) &&
git stash &&
test new != $(cat file) &&
- test submodule = $(git diff --name-only) &&
- test $CURRENT = $(cd submodule && git rev-parse HEAD) &&
+ echo submodule >expect &&
+ git diff --name-only >actual &&
+ test_cmp expect actual &&
+
+ echo "$CURRENT" >expect &&
+ git -C submodule rev-parse HEAD >actual &&
+ test_cmp expect actual &&
+
git stash apply &&
test new = $(cat file) &&
- test $CURRENT = $(cd submodule && git rev-parse HEAD)
+ echo "$CURRENT" >expect &&
+ git -C submodule rev-parse HEAD >actual &&
+ test_cmp expect actual
'