@matheusbsbs / matheus-bagliano / commits / 4c367c6ae9
Fork 0

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 <gitster@pobox.com>

Junio C Hamano committed Mar 28, 2010 at 17:42 UTC 4c367c6ae978ef18477fba6b00458c32f1d49d0d
1 file changed +38 -33
t/t9350-fast-export.sh
+38 -33
@@ -150,20 +150,22 @@ test_expect_success 'setup submodule' '
150
151 git checkout -f master &&
152 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 + ) &&
160 git submodule add "`pwd`/sub" sub &&
161 git commit -m initial &&
162 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 + ) &&
169 git add sub &&
170 git commit -m second
171
@@ -264,19 +266,20 @@ test_expect_success 'cope with tagger-less tags' '
266
267 test_expect_success 'setup for limiting exports by PATH' '
268 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 + )
283 '
284
285 cat > limit-by-paths/expected << EOF
@@ -297,10 +300,11 @@ M 100644 :1 there
300 EOF
301
302 test_expect_success 'dropping tag of filtered out object' '
303 +(
304 cd limit-by-paths &&
305 git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
302 - test_cmp output expected &&
303 - cd ..
306 + test_cmp output expected
307 +)
308 '
309
310 cat >> limit-by-paths/expected << EOF
@@ -313,10 +317,11 @@ msg
317 EOF
318
319 test_expect_success 'rewriting tag of filtered out object' '
320 +(
321 cd limit-by-paths &&
322 git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
318 - test_cmp output expected &&
319 - cd ..
323 + test_cmp output expected
324 +)
325 '
326
327 cat > limit-by-paths/expected << EOF
@@ -343,13 +348,13 @@ M 100644 :2 there
348 EOF
349
350 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 + )
356 '
357
352 -
358 test_expect_success 'set-up a few more tags for tag export tests' '
359 git checkout -f master &&
360 HEAD_TREE=`git show -s --pretty=raw HEAD | grep tree | sed "s/tree //"` &&