t7405: cd inside subshell instead of around
Instead of using `cd dir && (...) && cd..` use `(cd dir && ...)` This ensures that the test doesn't get caught in the subdirectory if there is an error in the subshell. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jens Lehmann committed
Sep 1, 2010 at 23:01 UTC
1e2847634e7f171b1625295e3f41c1660ff4a61f
1 file changed
+6
-11
t/t7405-submodule-merge.sh
+6
-11
@@ -67,7 +67,7 @@ test_expect_success setup '
67
# b in the main repository.
68
test_expect_success 'setup for merge search' '
69
mkdir merge-search &&
70
- cd merge-search &&
70
+ (cd merge-search &&
71
git init &&
72
mkdir sub &&
73
(cd sub &&
@@ -101,8 +101,7 @@ test_expect_success 'setup for merge search' '
101
git checkout -b sub-d sub-b &&
102
git merge sub-c) &&
103
git commit -a -m "d" &&
104
- git branch test b &&
105
- cd ..
104
+ git branch test b)
105
'
106
107
test_expect_success 'merge with one side as a fast-forward of the other' '
@@ -126,7 +125,7 @@ test_expect_success 'merging should conflict for non fast-forward' '
125
'
126
127
test_expect_success 'merging should fail for ambiguous common parent' '
129
- cd merge-search &&
128
+ (cd merge-search &&
129
git checkout -b test-ambiguous b &&
130
(cd sub &&
131
git checkout -b ambiguous sub-b &&
@@ -136,8 +135,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '
135
test_must_fail git merge c 2> actual &&
136
grep $(cat expect1) actual > /dev/null &&
137
grep $(cat expect2) actual > /dev/null &&
139
- git reset --hard &&
140
- cd ..
138
+ git reset --hard)
139
'
140
141
# in a situation like this
@@ -158,7 +156,7 @@ test_expect_success 'merging should fail for ambiguous common parent' '
156
# commits (sub-a) does not descend from the submodule merge-base (sub-b).
157
#
158
test_expect_success 'merging should fail for changes that are backwards' '
161
- cd merge-search &&
159
+ (cd merge-search &&
160
git checkout -b bb a &&
161
(cd sub &&
162
git checkout sub-b) &&
@@ -175,16 +173,13 @@ test_expect_success 'merging should fail for changes that are backwards' '
173
git commit -a -m "f" &&
174
175
git checkout -b test-backward e &&
178
- test_must_fail git merge f &&
179
- cd ..
176
+ test_must_fail git merge f)
177
'
178
179
test_expect_success 'merging with a modify/modify conflict between merge bases' '
183
-
180
git reset --hard HEAD &&
181
git checkout -b test2 c &&
182
git merge d
187
-
183
'
184
185
test_done