summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2021-02-09 07:28:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-02-11 21:34:58 (GMT)
commit389ece402292f066be6bb4a22ac72682a6a2aea6 (patch)
treeb2b559ae7eeb750c3bfe3db6475002f83a1ffc4e
parentbbaa45c3aace10e25ae9dd966e867796fbf440ad (diff)
downloadgit-389ece402292f066be6bb4a22ac72682a6a2aea6.zip
git-389ece402292f066be6bb4a22ac72682a6a2aea6.tar.gz
git-389ece402292f066be6bb4a22ac72682a6a2aea6.tar.bz2
t3905: remove nested git in command substitution
If a git command in a nested command substitution fails, it will be silently ignored since only the return code of the outer command substitutions is reported. Factor out nested command substitutions so that the error codes of those commands are reported. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xt/t3905-stash-include-untracked.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/t/t3905-stash-include-untracked.sh b/t/t3905-stash-include-untracked.sh
index 892a2c8..f008e5d 100755
--- a/t/t3905-stash-include-untracked.sh
+++ b/t/t3905-stash-include-untracked.sh
@@ -36,8 +36,10 @@ test_expect_success 'stash save --include-untracked cleaned the untracked files'
'
test_expect_success 'stash save --include-untracked stashed the untracked files' '
- tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin)) &&
- untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin)) &&
+ one_blob=$(echo 1 | git hash-object --stdin) &&
+ tracked=$(git rev-parse --short "$one_blob") &&
+ untracked_blob=$(echo untracked | git hash-object --stdin) &&
+ untracked=$(git rev-parse --short "$untracked_blob") &&
cat >expect.diff <<-EOF &&
diff --git a/HEAD b/HEAD
new file mode 100644
@@ -117,7 +119,8 @@ test_expect_success 'stash save -u dirty index' '
'
test_expect_success 'stash save --include-untracked dirty index got stashed' '
- blob=$(git rev-parse --short $(echo 4 | git hash-object --stdin)) &&
+ four_blob=$(echo 4 | git hash-object --stdin) &&
+ blob=$(git rev-parse --short "$four_blob") &&
cat >expect <<-EOF &&
diff --git a/file3 b/file3
new file mode 100644