Skip to content

Commit 4c367c6

Browse files
committed
t9350: fix careless use of "cd"
Upon failure of any of these tests (or when a test that is marked as expecting a failure is fixed), we will end up running later tests in random places. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42accae commit 4c367c6

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

t/t9350-fast-export.sh

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,22 @@ test_expect_success 'setup submodule' '
150150
151151
git checkout -f master &&
152152
mkdir sub &&
153-
cd sub &&
154-
git init &&
155-
echo test file > file &&
156-
git add file &&
157-
git commit -m sub_initial &&
158-
cd .. &&
153+
(
154+
cd sub &&
155+
git init &&
156+
echo test file > file &&
157+
git add file &&
158+
git commit -m sub_initial
159+
) &&
159160
git submodule add "`pwd`/sub" sub &&
160161
git commit -m initial &&
161162
test_tick &&
162-
cd sub &&
163-
echo more data >> file &&
164-
git add file &&
165-
git commit -m sub_second &&
166-
cd .. &&
163+
(
164+
cd sub &&
165+
echo more data >> file &&
166+
git add file &&
167+
git commit -m sub_second
168+
) &&
167169
git add sub &&
168170
git commit -m second
169171
@@ -264,19 +266,20 @@ test_expect_success 'cope with tagger-less tags' '
264266

265267
test_expect_success 'setup for limiting exports by PATH' '
266268
mkdir limit-by-paths &&
267-
cd limit-by-paths &&
268-
git init &&
269-
echo hi > there &&
270-
git add there &&
271-
git commit -m "First file" &&
272-
echo foo > bar &&
273-
git add bar &&
274-
git commit -m "Second file" &&
275-
git tag -a -m msg mytag &&
276-
echo morefoo >> bar &&
277-
git add bar &&
278-
git commit -m "Change to second file" &&
279-
cd ..
269+
(
270+
cd limit-by-paths &&
271+
git init &&
272+
echo hi > there &&
273+
git add there &&
274+
git commit -m "First file" &&
275+
echo foo > bar &&
276+
git add bar &&
277+
git commit -m "Second file" &&
278+
git tag -a -m msg mytag &&
279+
echo morefoo >> bar &&
280+
git add bar &&
281+
git commit -m "Change to second file"
282+
)
280283
'
281284

282285
cat > limit-by-paths/expected << EOF
@@ -297,10 +300,11 @@ M 100644 :1 there
297300
EOF
298301

299302
test_expect_success 'dropping tag of filtered out object' '
303+
(
300304
cd limit-by-paths &&
301305
git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
302-
test_cmp output expected &&
303-
cd ..
306+
test_cmp output expected
307+
)
304308
'
305309

306310
cat >> limit-by-paths/expected << EOF
@@ -313,10 +317,11 @@ msg
313317
EOF
314318

315319
test_expect_success 'rewriting tag of filtered out object' '
320+
(
316321
cd limit-by-paths &&
317322
git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
318-
test_cmp output expected &&
319-
cd ..
323+
test_cmp output expected
324+
)
320325
'
321326

322327
cat > limit-by-paths/expected << EOF
@@ -343,13 +348,13 @@ M 100644 :2 there
343348
EOF
344349

345350
test_expect_failure 'no exact-ref revisions included' '
346-
cd limit-by-paths &&
347-
git fast-export master~2..master~1 > output &&
348-
test_cmp output expected &&
349-
cd ..
351+
(
352+
cd limit-by-paths &&
353+
git fast-export master~2..master~1 > output &&
354+
test_cmp output expected
355+
)
350356
'
351357

352-
353358
test_expect_success 'set-up a few more tags for tag export tests' '
354359
git checkout -f master &&
355360
HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&

0 commit comments

Comments
 (0)