Skip to content

Commit 389ece4

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bbaa45c commit 389ece4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t3905-stash-include-untracked.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ test_expect_success 'stash save --include-untracked cleaned the untracked files'
3636
'
3737

3838
test_expect_success 'stash save --include-untracked stashed the untracked files' '
39-
tracked=$(git rev-parse --short $(echo 1 | git hash-object --stdin)) &&
40-
untracked=$(git rev-parse --short $(echo untracked | git hash-object --stdin)) &&
39+
one_blob=$(echo 1 | git hash-object --stdin) &&
40+
tracked=$(git rev-parse --short "$one_blob") &&
41+
untracked_blob=$(echo untracked | git hash-object --stdin) &&
42+
untracked=$(git rev-parse --short "$untracked_blob") &&
4143
cat >expect.diff <<-EOF &&
4244
diff --git a/HEAD b/HEAD
4345
new file mode 100644
@@ -117,7 +119,8 @@ test_expect_success 'stash save -u dirty index' '
117119
'
118120

119121
test_expect_success 'stash save --include-untracked dirty index got stashed' '
120-
blob=$(git rev-parse --short $(echo 4 | git hash-object --stdin)) &&
122+
four_blob=$(echo 4 | git hash-object --stdin) &&
123+
blob=$(git rev-parse --short "$four_blob") &&
121124
cat >expect <<-EOF &&
122125
diff --git a/file3 b/file3
123126
new file mode 100644

0 commit comments

Comments
 (0)