Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Several tests: cd inside subshell instead of around

Fixed all places where it was a straightforward change from cd'ing into a
directory and back via "cd .." to a cd inside a subshell.

Found these places with "git grep -w "cd \.\.".

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information...
commit fd4ec4f2bb980ce07bb28d5823a95610f251d00b 1 parent af24059
Jens Lehmann authored September 06, 2010 gitster committed September 06, 2010

Showing 32 changed files with 256 additions and 260 deletions. Show diff stats Hide diff stats

  1. 6  t/t1020-subdirectory.sh
  2. 6  t/t1302-repo-version.sh
  3. 6  t/t2101-update-index-reupdate.sh
  4. 4  t/t3060-ls-files-with-tree.sh
  5. 12  t/t3409-rebase-preserve-merges.sh
  6. 6  t/t3903-stash.sh
  7. 6  t/t4041-diff-submodule-option.sh
  8. 18  t/t5510-fetch.sh
  9. 22  t/t6050-replace.sh
  10. 6  t/t7400-submodule-basic.sh
  11. 6  t/t7401-submodule-summary.sh
  12. 6  t/t9100-git-svn-basic.sh
  13. 16  t/t9101-git-svn-props.sh
  14. 6  t/t9102-git-svn-deep-rmdir.sh
  15. 30  t/t9104-git-svn-follow-parent.sh
  16. 6  t/t9105-git-svn-commit-diff.sh
  17. 24  t/t9106-git-svn-commit-diff-clobber.sh
  18. 4  t/t9107-git-svn-migrate.sh
  19. 6  t/t9114-git-svn-dcommit-merge.sh
  20. 6  t/t9115-git-svn-dcommit-funky-renames.sh
  21. 4  t/t9116-git-svn-log.sh
  22. 126  t/t9119-git-svn-info.sh
  23. 6  t/t9120-git-svn-clone-with-percent-escapes.sh
  24. 4  t/t9123-git-svn-rebuild-with-rewriteroot.sh
  25. 12  t/t9125-git-svn-multi-glob-branch-names.sh
  26. 30  t/t9127-git-svn-partial-rebuild.sh
  27. 18  t/t9128-git-svn-cmd-branch.sh
  28. 12  t/t9137-git-svn-dcommit-clobber-series.sh
  29. 5  t/t9300-fast-import.sh
  30. 53  t/t9401-git-cvsserver-crlf.sh
  31. 38  t/t9600-cvsimport.sh
  32. 6  t/t9603-cvsimport-patchsets.sh
6  t/t1020-subdirectory.sh
@@ -27,13 +27,13 @@ test_expect_success 'update-index and ls-files' '
27 27
 	one) echo pass one ;;
28 28
 	*) echo bad one; exit 1 ;;
29 29
 	esac &&
30  
-	cd dir &&
  30
+	(cd dir &&
31 31
 	git update-index --add two &&
32 32
 	case "`git ls-files`" in
33 33
 	two) echo pass two ;;
34 34
 	*) echo bad two; exit 1 ;;
35  
-	esac &&
36  
-	cd .. &&
  35
+	esac
  36
+	) &&
37 37
 	case "`git ls-files`" in
38 38
 	dir/two"$LF"one) echo pass both ;;
39 39
 	*) echo bad; exit 1 ;;
6  t/t1302-repo-version.sh
@@ -32,9 +32,9 @@ test_expect_success 'gitdir selection on unsupported repo' '
32 32
 	test "$(git config core.repositoryformatversion)" = 99)'
33 33
 
34 34
 test_expect_success 'gitdir not required mode' '
35  
-	(git apply --stat test.patch &&
36  
-	cd test && git apply --stat ../test.patch &&
37  
-	cd ../test2 && git apply --stat ../test.patch)'
  35
+	git apply --stat test.patch &&
  36
+	(cd test && git apply --stat ../test.patch) &&
  37
+	(cd test2 && git apply --stat ../test.patch)'
38 38
 
39 39
 test_expect_success 'gitdir required mode on normal repos' '
40 40
 	(git apply --check --index test.patch &&
6  t/t2101-update-index-reupdate.sh
@@ -63,10 +63,10 @@ cat > expected <<\EOF
63 63
 EOF
64 64
 test_expect_success 'update-index --update from subdir' \
65 65
 	'echo not so happy >file2 &&
66  
-	cd dir1 &&
  66
+	(cd dir1 &&
67 67
 	cat ../file2 >file3 &&
68  
-	git update-index --again &&
69  
-	cd .. &&
  68
+	git update-index --again
  69
+	) &&
70 70
 	git ls-files -s >current &&
71 71
 	cmp current expected'
72 72
 
4  t/t3060-ls-files-with-tree.sh
@@ -55,15 +55,13 @@ test_expect_success setup '
55 55
 
56 56
 # We have to run from a sub-directory to trigger prune_path
57 57
 # Then we finally get to run our --with-tree test
58  
-cd sub
59 58
 
60 59
 test_expect_success 'git -ls-files --with-tree should succeed from subdir' '
61 60
 
62  
-	git ls-files --with-tree=HEAD~1 >../output
  61
+	(cd sub && git ls-files --with-tree=HEAD~1 >../output)
63 62
 
64 63
 '
65 64
 
66  
-cd ..
67 65
 test_expect_success \
68 66
     'git -ls-files --with-tree should add entries from named tree.' \
69 67
     'test_cmp expected output'
12  t/t3409-rebase-preserve-merges.sh
@@ -42,23 +42,23 @@ test_expect_success 'setup for merge-preserving rebase' \
42 42
 	git commit -a -m "Modify A2" &&
43 43
 
44 44
 	git clone ./. clone1 &&
45  
-	cd clone1 &&
  45
+	(cd clone1 &&
46 46
 	git checkout -b topic origin/topic &&
47  
-	git merge origin/master &&
48  
-	cd .. &&
  47
+	git merge origin/master
  48
+	) &&
49 49
 
50 50
 	echo Fifth > B &&
51 51
 	git add B &&
52 52
 	git commit -m "Add different B" &&
53 53
 
54 54
 	git clone ./. clone2 &&
55  
-	cd clone2 &&
  55
+	(cd clone2 &&
56 56
 	git checkout -b topic origin/topic &&
57 57
 	test_must_fail git merge origin/master &&
58 58
 	echo Resolved > B &&
59 59
 	git add B &&
60  
-	git commit -m "Merge origin/master into topic" &&
61  
-	cd .. &&
  60
+	git commit -m "Merge origin/master into topic"
  61
+	) &&
62 62
 
63 63
 	git checkout topic &&
64 64
 	echo Fourth >> B &&
6  t/t3903-stash.sh
@@ -69,9 +69,9 @@ test_expect_success 'apply stashed changes (including index)' '
69 69
 test_expect_success 'unstashing in a subdirectory' '
70 70
 	git reset --hard HEAD &&
71 71
 	mkdir subdir &&
72  
-	cd subdir &&
73  
-	git stash apply &&
74  
-	cd ..
  72
+	(cd subdir &&
  73
+	git stash apply
  74
+	)
75 75
 '
76 76
 
77 77
 test_expect_success 'drop top stash' '
6  t/t4041-diff-submodule-option.sh
@@ -85,10 +85,10 @@ EOF
85 85
 "
86 86
 
87 87
 commit_file sm1 &&
88  
-cd sm1 &&
  88
+head3=$(cd sm1 &&
89 89
 git reset --hard HEAD~2 >/dev/null &&
90  
-head3=$(git rev-parse --verify HEAD | cut -c1-7) &&
91  
-cd ..
  90
+git rev-parse --verify HEAD | cut -c1-7
  91
+)
92 92
 
93 93
 test_expect_success 'modified submodule(backward)' "
94 94
 	git diff-index -p --submodule=log HEAD >actual &&
18  t/t5510-fetch.sh
@@ -21,18 +21,18 @@ test_expect_success setup '
21 21
 
22 22
 test_expect_success "clone and setup child repos" '
23 23
 	git clone . one &&
24  
-	cd one &&
  24
+	(cd one &&
25 25
 	echo >file updated by one &&
26  
-	git commit -a -m "updated by one" &&
27  
-	cd .. &&
  26
+	git commit -a -m "updated by one"
  27
+	) &&
28 28
 	git clone . two &&
29  
-	cd two &&
  29
+	(cd two &&
30 30
 	git config branch.master.remote one &&
31 31
 	git config remote.one.url ../one/.git/ &&
32  
-	git config remote.one.fetch refs/heads/master:refs/heads/one &&
33  
-	cd .. &&
  32
+	git config remote.one.fetch refs/heads/master:refs/heads/one
  33
+	) &&
34 34
 	git clone . three &&
35  
-	cd three &&
  35
+	(cd three &&
36 36
 	git config branch.master.remote two &&
37 37
 	git config branch.master.merge refs/heads/one &&
38 38
 	mkdir -p .git/remotes &&
@@ -40,8 +40,8 @@ test_expect_success "clone and setup child repos" '
40 40
 		echo "URL: ../two/.git/"
41 41
 		echo "Pull: refs/heads/master:refs/heads/two"
42 42
 		echo "Pull: refs/heads/one:refs/heads/one"
43  
-	} >.git/remotes/two &&
44  
-	cd .. &&
  43
+	} >.git/remotes/two
  44
+	) &&
45 45
 	git clone . bundle &&
46 46
 	git clone . seven
47 47
 '
22  t/t6050-replace.sh
@@ -104,7 +104,7 @@ test_expect_success '"git fsck" works' '
104 104
 test_expect_success 'repack, clone and fetch work' '
105 105
      git repack -a -d &&
106 106
      git clone --no-hardlinks . clone_dir &&
107  
-     cd clone_dir &&
  107
+     (cd clone_dir &&
108 108
      git show HEAD~5 | grep "A U Thor" &&
109 109
      git show $HASH2 | grep "A U Thor" &&
110 110
      git cat-file commit $R &&
@@ -113,8 +113,8 @@ test_expect_success 'repack, clone and fetch work' '
113 113
      git fetch ../ "refs/replace/*:refs/replace/*" &&
114 114
      git show HEAD~5 | grep "O Thor" &&
115 115
      git show $HASH2 | grep "O Thor" &&
116  
-     git cat-file commit $R &&
117  
-     cd ..
  116
+     git cat-file commit $R
  117
+     )
118 118
 '
119 119
 
120 120
 test_expect_success '"git replace" listing and deleting' '
@@ -177,10 +177,10 @@ test_expect_success 'create parallel branch without the bug' '
177 177
 
178 178
 test_expect_success 'push to cloned repo' '
179 179
      git push cloned $HASH6^:refs/heads/parallel &&
180  
-     cd clone_dir &&
  180
+     (cd clone_dir &&
181 181
      git checkout parallel &&
182  
-     git log --pretty=oneline | grep $PARA2 &&
183  
-     cd ..
  182
+     git log --pretty=oneline | grep $PARA2
  183
+     )
184 184
 '
185 185
 
186 186
 test_expect_success 'push branch with replacement' '
@@ -191,20 +191,20 @@ test_expect_success 'push branch with replacement' '
191 191
      git show $HASH6~2 | grep "O Thor" &&
192 192
      git show $PARA3 | grep "O Thor" &&
193 193
      git push cloned $HASH6^:refs/heads/parallel2 &&
194  
-     cd clone_dir &&
  194
+     (cd clone_dir &&
195 195
      git checkout parallel2 &&
196 196
      git log --pretty=oneline | grep $PARA3 &&
197  
-     git show $PARA3 | grep "A U Thor" &&
198  
-     cd ..
  197
+     git show $PARA3 | grep "A U Thor"
  198
+     )
199 199
 '
200 200
 
201 201
 test_expect_success 'fetch branch with replacement' '
202 202
      git branch tofetch $HASH6 &&
203  
-     cd clone_dir &&
  203
+     (cd clone_dir &&
204 204
      git fetch origin refs/heads/tofetch:refs/heads/parallel3
205 205
      git log --pretty=oneline parallel3 | grep $PARA3
206 206
      git show $PARA3 | grep "A U Thor"
207  
-     cd ..
  207
+     )
208 208
 '
209 209
 
210 210
 test_expect_success 'bisect and replacements' '
6  t/t7400-submodule-basic.sh
@@ -413,12 +413,12 @@ test_expect_success 'submodule <invalid-path> warns' '
413 413
 
414 414
 test_expect_success 'add submodules without specifying an explicit path' '
415 415
 	mkdir repo &&
416  
-	cd repo &&
  416
+	(cd repo &&
417 417
 	git init &&
418 418
 	echo r >r &&
419 419
 	git add r &&
420  
-	git commit -m "repo commit 1" &&
421  
-	cd .. &&
  420
+	git commit -m "repo commit 1"
  421
+	) &&
422 422
 	git clone --bare repo/ bare.git &&
423 423
 	cd addtest &&
424 424
 	git submodule add "$submodurl/repo" &&
6  t/t7401-submodule-summary.sh
@@ -66,10 +66,10 @@ EOF
66 66
 "
67 67
 
68 68
 commit_file sm1 &&
69  
-cd sm1 &&
  69
+head3=$(cd sm1 &&
70 70
 git reset --hard HEAD~2 >/dev/null &&
71  
-head3=$(git rev-parse --verify HEAD | cut -c1-7) &&
72  
-cd ..
  71
+git rev-parse --verify HEAD | cut -c1-7
  72
+)
73 73
 
74 74
 test_expect_success 'modified submodule(backward)' "
75 75
     git submodule summary >actual &&
6  t/t9100-git-svn-basic.sh
@@ -22,7 +22,7 @@ esac
22 22
 test_expect_success \
23 23
     'initialize git svn' '
24 24
 	mkdir import &&
25  
-	cd import &&
  25
+	(cd import &&
26 26
 	echo foo > foo &&
27 27
 	ln -s foo foo.link
28 28
 	mkdir -p dir/a/b/c/d/e &&
@@ -31,8 +31,8 @@ test_expect_success \
31 31
 	echo "zzz" > bar/zzz &&
32 32
 	echo "#!/bin/sh" > exec.sh &&
33 33
 	chmod +x exec.sh &&
34  
-	svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null &&
35  
-	cd .. &&
  34
+	svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null
  35
+	) &&
36 36
 	rm -rf import &&
37 37
 	git svn init "$svnrepo"'
38 38
 
16  t/t9101-git-svn-props.sh
@@ -54,7 +54,7 @@ cd ..
54 54
 rm -rf import
55 55
 test_expect_success 'checkout working copy from svn' 'svn co "$svnrepo" test_wc'
56 56
 test_expect_success 'setup some commits to svn' \
57  
-	'cd test_wc &&
  57
+	'(cd test_wc &&
58 58
 		echo Greetings >> kw.c &&
59 59
 		poke kw.c &&
60 60
 		svn_cmd commit -m "Not yet an Id" &&
@@ -63,8 +63,8 @@ test_expect_success 'setup some commits to svn' \
63 63
 		svn_cmd commit -m "Modified file, but still not yet an Id" &&
64 64
 		svn_cmd propset svn:keywords Id kw.c &&
65 65
 		poke kw.c &&
66  
-		svn_cmd commit -m "Propset Id" &&
67  
-	cd ..'
  66
+		svn_cmd commit -m "Propset Id"
  67
+	)'
68 68
 
69 69
 test_expect_success 'initialize git svn' 'git svn init "$svnrepo"'
70 70
 test_expect_success 'fetch revisions from svn' 'git svn fetch'
@@ -82,12 +82,12 @@ got="`sed -ne 2p kw.c`"
82 82
 test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"
83 83
 
84 84
 test_expect_success "propset CR on crlf files" \
85  
-	'cd test_wc &&
  85
+	'(cd test_wc &&
86 86
 		svn_cmd propset svn:eol-style CR empty &&
87 87
 		svn_cmd propset svn:eol-style CR crlf &&
88 88
 		svn_cmd propset svn:eol-style CR ne_crlf &&
89  
-		svn_cmd commit -m "propset CR on crlf files" &&
90  
-	 cd ..'
  89
+		svn_cmd commit -m "propset CR on crlf files"
  90
+	 )'
91 91
 
92 92
 test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
93 93
 	'git svn fetch &&
@@ -137,7 +137,7 @@ cat > show-ignore.expect <<\EOF
137 137
 EOF
138 138
 
139 139
 test_expect_success 'test show-ignore' "
140  
-	cd test_wc &&
  140
+	(cd test_wc &&
141 141
 	mkdir -p deeply/nested/directory &&
142 142
 	touch deeply/nested/directory/.keep &&
143 143
 	svn_cmd add deeply &&
@@ -146,7 +146,7 @@ test_expect_success 'test show-ignore' "
146 146
 no-such-file*
147 147
 ' .
148 148
 	svn_cmd commit -m 'propset svn:ignore'
149  
-	cd .. &&
  149
+	) &&
150 150
 	git svn show-ignore > show-ignore.got &&
151 151
 	cmp show-ignore.expect show-ignore.got
152 152
 	"
6  t/t9102-git-svn-deep-rmdir.sh
@@ -4,13 +4,13 @@ test_description='git svn rmdir'
4 4
 
5 5
 test_expect_success 'initialize repo' '
6 6
 	mkdir import &&
7  
-	cd import &&
  7
+	(cd import &&
8 8
 	mkdir -p deeply/nested/directory/number/1 &&
9 9
 	mkdir -p deeply/nested/directory/number/2 &&
10 10
 	echo foo > deeply/nested/directory/number/1/file &&
11 11
 	echo foo > deeply/nested/directory/number/2/another &&
12  
-	svn_cmd import -m "import for git svn" . "$svnrepo" &&
13  
-	cd ..
  12
+	svn_cmd import -m "import for git svn" . "$svnrepo"
  13
+	)
14 14
 	'
15 15
 
16 16
 test_expect_success 'mirror via git svn' '
30  t/t9104-git-svn-follow-parent.sh
@@ -8,13 +8,13 @@ test_description='git svn fetching'
8 8
 
9 9
 test_expect_success 'initialize repo' '
10 10
 	mkdir import &&
11  
-	cd import &&
  11
+	(cd import &&
12 12
 	mkdir -p trunk &&
13 13
 	echo hello > trunk/readme &&
14  
-	svn_cmd import -m "initial" . "$svnrepo" &&
15  
-	cd .. &&
  14
+	svn_cmd import -m "initial" . "$svnrepo"
  15
+	) &&
16 16
 	svn_cmd co "$svnrepo" wc &&
17  
-	cd wc &&
  17
+	(cd wc &&
18 18
 	echo world >> trunk/readme &&
19 19
 	poke trunk/readme &&
20 20
 	svn_cmd commit -m "another commit" &&
@@ -22,8 +22,8 @@ test_expect_success 'initialize repo' '
22 22
 	svn_cmd mv trunk thunk &&
23 23
 	echo goodbye >> thunk/readme &&
24 24
 	poke thunk/readme &&
25  
-	svn_cmd commit -m "bye now" &&
26  
-	cd ..
  25
+	svn_cmd commit -m "bye now"
  26
+	)
27 27
 	'
28 28
 
29 29
 test_expect_success 'init and fetch a moved directory' '
@@ -85,11 +85,11 @@ test_expect_success 'follow larger parent' '
85 85
 test_expect_success 'follow higher-level parent' '
86 86
         svn mkdir -m "follow higher-level parent" "$svnrepo"/blob &&
87 87
         svn co "$svnrepo"/blob blob &&
88  
-        cd blob &&
  88
+	(cd blob &&
89 89
                 echo hi > hi &&
90 90
                 svn add hi &&
91  
-                svn commit -m "hihi" &&
92  
-                cd ..
  91
+		svn commit -m "hihi"
  92
+		) &&
93 93
         svn mkdir -m "new glob at top level" "$svnrepo"/glob &&
94 94
         svn mv -m "move blob down a level" "$svnrepo"/blob "$svnrepo"/glob/blob &&
95 95
         git svn init --minimize-url -i blob "$svnrepo"/glob/blob &&
@@ -117,18 +117,18 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
117 117
 	   import/trunk/subversion/bindings/swig/perl/t/larger-parent &&
118 118
 	  echo "bad delete test 2" > \
119 119
 	   import/trunk/subversion/bindings/swig/perl/another-larger &&
120  
-	cd import &&
121  
-	  svn import -m "r9270 test" . "$svnrepo"/r9270 &&
122  
-	cd .. &&
  120
+	(cd import &&
  121
+	  svn import -m "r9270 test" . "$svnrepo"/r9270
  122
+	) &&
123 123
 	svn_cmd co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
124  
-	cd r9270 &&
  124
+	(cd r9270 &&
125 125
 	  svn mkdir native &&
126 126
 	  svn mv t native/t &&
127 127
 	  for i in a b c; do svn mv $i.pm native/$i.pm; done &&
128 128
 	  echo z >> native/t/c.t &&
129 129
 	  poke native/t/c.t &&
130  
-	  svn commit -m "reorg test" &&
131  
-	cd .. &&
  130
+	  svn commit -m "reorg test"
  131
+	) &&
132 132
 	git svn init --minimize-url -i r9270-t \
133 133
 	  "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
134 134
 	git svn fetch -i r9270-t &&
6  t/t9105-git-svn-commit-diff.sh
@@ -6,10 +6,10 @@ test_description='git svn commit-diff'
6 6
 
7 7
 test_expect_success 'initialize repo' '
8 8
 	mkdir import &&
9  
-	cd import &&
  9
+	(cd import &&
10 10
 	echo hello > readme &&
11  
-	svn_cmd import -m "initial" . "$svnrepo" &&
12  
-	cd .. &&
  11
+	svn_cmd import -m "initial" . "$svnrepo"
  12
+	) &&
13 13
 	echo hello > readme &&
14 14
 	git update-index --add readme &&
15 15
 	git commit -a -m "initial" &&
24  t/t9106-git-svn-commit-diff-clobber.sh
@@ -6,21 +6,21 @@ test_description='git svn commit-diff clobber'
6 6
 
7 7
 test_expect_success 'initialize repo' '
8 8
 	mkdir import &&
9  
-	cd import &&
  9
+	(cd import &&
10 10
 	echo initial > file &&
11  
-	svn_cmd import -m "initial" . "$svnrepo" &&
12  
-	cd .. &&
  11
+	svn_cmd import -m "initial" . "$svnrepo"
  12
+	) &&
13 13
 	echo initial > file &&
14 14
 	git update-index --add file &&
15 15
 	git commit -a -m "initial"
16 16
 	'
17 17
 test_expect_success 'commit change from svn side' '
18 18
 	svn_cmd co "$svnrepo" t.svn &&
19  
-	cd t.svn &&
  19
+	(cd t.svn &&
20 20
 	echo second line from svn >> file &&
21 21
 	poke file &&
22  
-	svn_cmd commit -m "second line from svn" &&
23  
-	cd .. &&
  22
+	svn_cmd commit -m "second line from svn"
  23
+	) &&
24 24
 	rm -rf t.svn
25 25
 	'
26 26
 
@@ -44,11 +44,11 @@ test_expect_success 'dcommit fails to commit because of conflict' '
44 44
 	git svn fetch &&
45 45
 	git reset --hard refs/${remotes_git_svn} &&
46 46
 	svn_cmd co "$svnrepo" t.svn &&
47  
-	cd t.svn &&
  47
+	(cd t.svn &&
48 48
 	echo fourth line from svn >> file &&
49 49
 	poke file &&
50  
-	svn_cmd commit -m "fourth line from svn" &&
51  
-	cd .. &&
  50
+	svn_cmd commit -m "fourth line from svn"
  51
+	) &&
52 52
 	rm -rf t.svn &&
53 53
 	echo "fourth line from git" >> file &&
54 54
 	git commit -a -m "fourth line from git" &&
@@ -68,11 +68,11 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
68 68
 
69 69
 test_expect_success 'commit another change from svn side' '
70 70
 	svn_cmd co "$svnrepo" t.svn &&
71  
-	cd t.svn &&
  71
+	(cd t.svn &&
72 72
 		echo third line from svn >> file &&
73 73
 		poke file &&
74  
-		svn_cmd commit -m "third line from svn" &&
75  
-	cd .. &&
  74
+		svn_cmd commit -m "third line from svn"
  75
+	) &&
76 76
 	rm -rf t.svn
77 77
 	'
78 78
 
4  t/t9107-git-svn-migrate.sh
@@ -6,14 +6,14 @@ test_description='git svn metadata migrations from previous versions'
6 6
 test_expect_success 'setup old-looking metadata' '
7 7
 	cp "$GIT_DIR"/config "$GIT_DIR"/config-old-git-svn &&
8 8
 	mkdir import &&
9  
-	cd import &&
  9
+	(cd import &&
10 10
 		for i in trunk branches/a branches/b \
11 11
 		         tags/0.1 tags/0.2 tags/0.3; do
12 12
 			mkdir -p $i && \
13 13
 			echo hello >> $i/README || exit 1
14 14
 		done && \
15 15
 		svn_cmd import -m test . "$svnrepo"
16  
-		cd .. &&
  16
+		) &&
17 17
 	git svn init "$svnrepo" &&
18 18
 	git svn fetch &&
19 19
 	rm -rf "$GIT_DIR"/svn &&
6  t/t9114-git-svn-dcommit-merge.sh
@@ -37,11 +37,11 @@ EOF
37 37
 test_expect_success 'setup svn repository' '
38 38
 	svn_cmd co "$svnrepo" mysvnwork &&
39 39
 	mkdir -p mysvnwork/trunk &&
40  
-	cd mysvnwork &&
  40
+	(cd mysvnwork &&
41 41
 		big_text_block >> trunk/README &&
42 42
 		svn_cmd add trunk &&
43  
-		svn_cmd ci -m "first commit" trunk &&
44  
-		cd ..
  43
+		svn_cmd ci -m "first commit" trunk
  44
+		)
45 45
 	'
46 46
 
47 47
 test_expect_success 'setup git mirror and merge' '
6  t/t9115-git-svn-dcommit-funky-renames.sh
@@ -61,11 +61,11 @@ test_expect_success 'add a file with plus signs' '
61 61
 
62 62
 test_expect_success 'clone the repository to test rebase' '
63 63
 	git svn clone "$svnrepo" test-rebase &&
64  
-	cd test-rebase &&
  64
+	(cd test-rebase &&
65 65
 		echo test-rebase > test-rebase &&
66 66
 		git add test-rebase &&
67  
-		git commit -m test-rebase &&
68  
-		cd ..
  67
+		git commit -m test-rebase
  68
+		)
69 69
 	'
70 70
 
71 71
 test_expect_success 'make a commit to test rebase' '
4  t/t9116-git-svn-log.sh
@@ -8,14 +8,14 @@ test_description='git svn log tests'
8 8
 
9 9
 test_expect_success 'setup repository and import' '
10 10
 	mkdir import &&
11  
-	cd import &&
  11
+	(cd import &&
12 12
 		for i in trunk branches/a branches/b \
13 13
 		         tags/0.1 tags/0.2 tags/0.3; do
14 14
 			mkdir -p $i && \
15 15
 			echo hello >> $i/README || exit 1
16 16
 		done && \
17 17
 		svn_cmd import -m test . "$svnrepo"
18  
-		cd .. &&
  18
+		) &&
19 19
 	git svn init "$svnrepo" -T trunk -b branches -t tags &&
20 20
 	git svn fetch &&
21 21
 	git reset --hard trunk &&
126  t/t9119-git-svn-info.sh
@@ -39,27 +39,27 @@ quoted_svnrepo="$(echo $svnrepo | sed 's/ /%20/')"
39 39
 
40 40
 test_expect_success 'setup repository and import' '
41 41
 	mkdir info &&
42  
-	cd info &&
  42
+	(cd info &&
43 43
 		echo FIRST > A &&
44 44
 		echo one > file &&
45 45
 		ln -s file symlink-file &&
46 46
 		mkdir directory &&
47 47
 		touch directory/.placeholder &&
48 48
 		ln -s directory symlink-directory &&
49  
-		svn_cmd import -m "initial" . "$svnrepo" &&
50  
-	cd .. &&
  49
+		svn_cmd import -m "initial" . "$svnrepo"
  50
+	) &&
51 51
 	svn_cmd co "$svnrepo" svnwc &&
52  
-	cd svnwc &&
  52
+	(cd svnwc &&
53 53
 		echo foo > foo &&
54 54
 		svn_cmd add foo &&
55 55
 		svn_cmd commit -m "change outside directory" &&
56  
-		svn_cmd update &&
57  
-	cd .. &&
  56
+		svn_cmd update
  57
+	) &&
58 58
 	mkdir gitwc &&
59  
-	cd gitwc &&
  59
+	(cd gitwc &&
60 60
 		git svn init "$svnrepo" &&
61  
-		git svn fetch &&
62  
-	cd .. &&
  61
+		git svn fetch
  62
+	) &&
63 63
 	ptouch gitwc/file svnwc/file &&
64 64
 	ptouch gitwc/directory svnwc/directory &&
65 65
 	ptouch gitwc/symlink-file svnwc/symlink-file &&
@@ -138,14 +138,14 @@ test_expect_success 'info --url symlink-directory' '
138 138
 
139 139
 test_expect_success 'info added-file' "
140 140
 	echo two > gitwc/added-file &&
141  
-	cd gitwc &&
142  
-		git add added-file &&
143  
-	cd .. &&
  141
+	(cd gitwc &&
  142
+		git add added-file
  143
+	) &&
144 144
 	cp gitwc/added-file svnwc/added-file &&
145 145
 	ptouch gitwc/added-file svnwc/added-file &&
146  
-	cd svnwc &&
147  
-		svn_cmd add added-file > /dev/null &&
148  
-	cd .. &&
  146
+	(cd svnwc &&
  147
+		svn_cmd add added-file > /dev/null
  148
+	) &&
149 149
 	(cd svnwc; svn info added-file) > expected.info-added-file &&
150 150
 	(cd gitwc; git svn info added-file) > actual.info-added-file &&
151 151
 	test_cmp expected.info-added-file actual.info-added-file
@@ -160,12 +160,12 @@ test_expect_success 'info added-directory' "
160 160
 	mkdir gitwc/added-directory svnwc/added-directory &&
161 161
 	ptouch gitwc/added-directory svnwc/added-directory &&
162 162
 	touch gitwc/added-directory/.placeholder &&
163  
-	cd svnwc &&
164  
-		svn_cmd add added-directory > /dev/null &&
165  
-	cd .. &&
166  
-	cd gitwc &&
167  
-		git add added-directory &&
168  
-	cd .. &&
  163
+	(cd svnwc &&
  164
+		svn_cmd add added-directory > /dev/null
  165
+	) &&
  166
+	(cd gitwc &&
  167
+		git add added-directory
  168
+	) &&
169 169
 	(cd svnwc; svn info added-directory) \
170 170
 		> expected.info-added-directory &&
171 171
 	(cd gitwc; git svn info added-directory) \
@@ -179,14 +179,14 @@ test_expect_success 'info --url added-directory' '
179 179
 	'
180 180
 
181 181
 test_expect_success 'info added-symlink-file' "
182  
-	cd gitwc &&
  182
+	(cd gitwc &&
183 183
 		ln -s added-file added-symlink-file &&
184  
-		git add added-symlink-file &&
185  
-	cd .. &&
186  
-	cd svnwc &&
  184
+		git add added-symlink-file
  185
+	) &&
  186
+	(cd svnwc &&
187 187
 		ln -s added-file added-symlink-file &&
188  
-		svn_cmd add added-symlink-file > /dev/null &&
189  
-	cd .. &&
  188
+		svn_cmd add added-symlink-file > /dev/null
  189
+	) &&
190 190
 	ptouch gitwc/added-symlink-file svnwc/added-symlink-file &&
191 191
 	(cd svnwc; svn info added-symlink-file) \
192 192
 		> expected.info-added-symlink-file &&
@@ -202,14 +202,14 @@ test_expect_success 'info --url added-symlink-file' '
202 202
 	'
203 203
 
204 204
 test_expect_success 'info added-symlink-directory' "
205  
-	cd gitwc &&
  205
+	(cd gitwc &&
206 206
 		ln -s added-directory added-symlink-directory &&
207  
-		git add added-symlink-directory &&
208  
-	cd .. &&
209  
-	cd svnwc &&
  207
+		git add added-symlink-directory
  208
+	) &&
  209
+	(cd svnwc &&
210 210
 		ln -s added-directory added-symlink-directory &&
211  
-		svn_cmd add added-symlink-directory > /dev/null &&
212  
-	cd .. &&
  211
+		svn_cmd add added-symlink-directory > /dev/null
  212
+	) &&
213 213
 	ptouch gitwc/added-symlink-directory svnwc/added-symlink-directory &&
214 214
 	(cd svnwc; svn info added-symlink-directory) \
215 215
 		> expected.info-added-symlink-directory &&
@@ -230,12 +230,12 @@ test_expect_success 'info --url added-symlink-directory' '
230 230
 # simply reuses the Last Changed Date.
231 231
 
232 232
 test_expect_success 'info deleted-file' "
233  
-	cd gitwc &&
234  
-		git rm -f file > /dev/null &&
235  
-	cd .. &&
236  
-	cd svnwc &&
237  
-		svn_cmd rm --force file > /dev/null &&
238  
-	cd .. &&
  233
+	(cd gitwc &&
  234
+		git rm -f file > /dev/null
  235
+	) &&
  236
+	(cd svnwc &&
  237
+		svn_cmd rm --force file > /dev/null
  238
+	) &&
239 239
 	(cd svnwc; svn info file) |
240 240
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
241 241
 		> expected.info-deleted-file &&
@@ -251,12 +251,12 @@ test_expect_success 'info --url file (deleted)' '
251 251
 	'
252 252
 
253 253
 test_expect_success 'info deleted-directory' "
254  
-	cd gitwc &&
255  
-		git rm -r -f directory > /dev/null &&
256  
-	cd .. &&
257  
-	cd svnwc &&
258  
-		svn_cmd rm --force directory > /dev/null &&
259  
-	cd .. &&
  254
+	(cd gitwc &&
  255
+		git rm -r -f directory > /dev/null
  256
+	) &&
  257
+	(cd svnwc &&
  258
+		svn_cmd rm --force directory > /dev/null
  259
+	) &&
260 260
 	(cd svnwc; svn info directory) |
261 261
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
262 262
 		> expected.info-deleted-directory &&
@@ -272,12 +272,12 @@ test_expect_success 'info --url directory (deleted)' '
272 272
 	'
273 273
 
274 274
 test_expect_success 'info deleted-symlink-file' "
275  
-	cd gitwc &&
276  
-		git rm -f symlink-file > /dev/null &&
277  
-	cd .. &&
278  
-	cd svnwc &&
279  
-		svn_cmd rm --force symlink-file > /dev/null &&
280  
-	cd .. &&
  275
+	(cd gitwc &&
  276
+		git rm -f symlink-file > /dev/null
  277
+	) &&
  278
+	(cd svnwc &&
  279
+		svn_cmd rm --force symlink-file > /dev/null
  280
+	) &&
281 281
 	(cd svnwc; svn info symlink-file) |
282 282
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
283 283
 		> expected.info-deleted-symlink-file &&
@@ -294,12 +294,12 @@ test_expect_success 'info --url symlink-file (deleted)' '
294 294
 	'
295 295
 
296 296
 test_expect_success 'info deleted-symlink-directory' "
297  
-	cd gitwc &&
298  
-		git rm -f symlink-directory > /dev/null &&
299  
-	cd .. &&
300  
-	cd svnwc &&
301  
-		svn_cmd rm --force symlink-directory > /dev/null &&
302  
-	cd .. &&
  297
+	(cd gitwc &&
  298
+		git rm -f symlink-directory > /dev/null
  299
+	) &&
  300
+	(cd svnwc &&
  301
+		svn_cmd rm --force symlink-directory > /dev/null
  302
+	) &&
303 303
 	(cd svnwc; svn info symlink-directory) |
304 304
 	sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \
305 305
 		 > expected.info-deleted-symlink-directory &&
@@ -346,9 +346,9 @@ test_expect_success 'info --url unknown-directory' '
346 346
 	'
347 347
 
348 348
 test_expect_success 'info unknown-symlink-file' "
349  
-	cd gitwc &&
350  
-		ln -s unknown-file unknown-symlink-file &&
351  
-	cd .. &&
  349
+	(cd gitwc &&
  350
+		ln -s unknown-file unknown-symlink-file
  351
+	) &&
352 352
 	(cd gitwc; test_must_fail git svn info unknown-symlink-file) \
353 353
 		 2> actual.info-unknown-symlink-file &&
354 354
 	grep unknown-symlink-file actual.info-unknown-symlink-file
@@ -361,9 +361,9 @@ test_expect_success 'info --url unknown-symlink-file' '
361 361
 	'
362 362
 
363 363
 test_expect_success 'info unknown-symlink-directory' "
364  
-	cd gitwc &&
365  
-		ln -s unknown-directory unknown-symlink-directory &&
366  
-	cd .. &&
  364
+	(cd gitwc &&
  365
+		ln -s unknown-directory unknown-symlink-directory
  366
+	) &&
367 367
 	(cd gitwc; test_must_fail git svn info unknown-symlink-directory) \
368 368
 		 2> actual.info-unknown-symlink-directory &&
369 369
 	grep unknown-symlink-directory actual.info-unknown-symlink-directory
6  t/t9120-git-svn-clone-with-percent-escapes.sh
@@ -20,9 +20,9 @@ test_expect_success 'setup svnrepo' '
20 20
 
21 21
 test_expect_success 'test clone with percent escapes' '
22 22
 	git svn clone "$svnrepo/pr%20ject" clone &&
23  
-	cd clone &&
24  
-		git rev-parse refs/${remotes_git_svn} &&
25  
-	cd ..
  23
+	(cd clone &&
  24
+		git rev-parse refs/${remotes_git_svn}
  25
+	)
26 26
 '
27 27
 
28 28
 # SVN works either way, so should we...
4  t/t9123-git-svn-rebuild-with-rewriteroot.sh
@@ -8,10 +8,10 @@ test_description='git svn respects rewriteRoot during rebuild'
8 8
 . ./lib-git-svn.sh
9 9
 
10 10
 mkdir import
11  
-cd import
  11
+(cd import
12 12
 	touch foo
13 13
 	svn_cmd import -m 'import for git svn' . "$svnrepo" >/dev/null
14  
-cd ..
  14
+)
15 15
 rm -rf import
16 16
 
17 17
 test_expect_success 'init, fetch and checkout repository' '
12  t/t9125-git-svn-multi-glob-branch-names.sh
@@ -19,19 +19,19 @@ test_expect_success 'setup svnrepo' '
19 19
 test_expect_success 'test clone with multi-glob in branch names' '
20 20
 	git svn clone -T trunk -b branches/*/* -t tags \
21 21
 	              "$svnrepo/project" project &&
22  
-	cd project &&
  22
+	(cd project &&
23 23
 		git rev-parse "refs/remotes/v14.1/beta" &&
24  
-		git rev-parse "refs/remotes/v14.1/gold" &&
25  
-	cd ..
  24
+		git rev-parse "refs/remotes/v14.1/gold"
  25
+	)
26 26
 	'
27 27
 
28 28
 test_expect_success 'test dcommit to multi-globbed branch' "
29  
-	cd project &&
  29
+	(cd project &&
30 30
 	git reset --hard 'refs/remotes/v14.1/gold' &&
31 31
 	echo hello >> foo &&
32 32
 	git commit -m 'hello' -- foo &&
33  
-	git svn dcommit &&
34  
-	cd ..
  33
+	git svn dcommit
  34
+	)
35 35
 	"
36 36
 
37 37
 test_done
30  t/t9127-git-svn-partial-rebuild.sh
@@ -9,27 +9,27 @@ test_description='git svn partial-rebuild tests'
9 9
 test_expect_success 'initialize svnrepo' '
10 10
 	mkdir import &&
11 11
 	(
12  
-		cd import &&
  12
+		(cd import &&
13 13
 		mkdir trunk branches tags &&
14  
-		cd trunk &&
15  
-		echo foo > foo &&
16  
-		cd .. &&
  14
+		(cd trunk &&
  15
+		echo foo > foo
  16
+		) &&
17 17
 		svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null &&
18 18
 		svn_cmd copy "$svnrepo"/trunk "$svnrepo"/branches/a \
19  
-			-m "created branch a" &&
20  
-		cd .. &&
  19
+			-m "created branch a"
  20
+		) &&
21 21
 		rm -rf import &&
22 22
 		svn_cmd co "$svnrepo"/trunk trunk &&
23  
-		cd trunk &&
  23
+		(cd trunk &&
24 24
 		echo bar >> foo &&
25  
-		svn_cmd ci -m "updated trunk" &&
26  
-		cd .. &&
  25
+		svn_cmd ci -m "updated trunk"
  26
+		) &&
27 27
 		svn_cmd co "$svnrepo"/branches/a a &&
28  
-		cd a &&
  28
+		(cd a &&
29 29
 		echo baz >> a &&
30 30
 		svn_cmd add a &&
31  
-		svn_cmd ci -m "updated a" &&
32  
-		cd .. &&
  31
+		svn_cmd ci -m "updated a"
  32
+		) &&
33 33
 		git svn init --stdlayout "$svnrepo"
34 34
 	)
35 35
 '
@@ -41,11 +41,11 @@ test_expect_success 'import an early SVN revision into git' '
41 41
 test_expect_success 'make full git mirror of SVN' '
42 42
 	mkdir mirror &&
43 43
 	(
44  
-		cd mirror &&
  44
+		(cd mirror &&
45 45
 		git init &&
46 46
 		git svn init --stdlayout "$svnrepo" &&
47  
-		git svn fetch &&
48  
-		cd ..
  47
+		git svn fetch
  48
+		)
49 49
 	)
50 50
 '
51 51
 
18  t/t9128-git-svn-cmd-branch.sh
@@ -9,19 +9,19 @@ test_description='git svn partial-rebuild tests'
9 9
 test_expect_success 'initialize svnrepo' '
10 10
 	mkdir import &&
11 11
 	(
12  
-		cd import &&
  12
+		(cd import &&
13 13
 		mkdir trunk branches tags &&
14  
-		cd trunk &&
15  
-		echo foo > foo &&
16  
-		cd .. &&
17  
-		svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null &&
18  
-		cd .. &&
  14
+		(cd trunk &&
  15
+		echo foo > foo
  16
+		) &&
  17
+		svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
  18
+		) &&
19 19
 		rm -rf import &&
20 20
 		svn_cmd co "$svnrepo"/trunk trunk &&
21  
-		cd trunk &&
  21
+		(cd trunk &&
22 22
 		echo bar >> foo &&
23  
-		svn_cmd ci -m "updated trunk" &&
24  
-		cd .. &&
  23
+		svn_cmd ci -m "updated trunk"
  24
+		) &&
25 25
 		rm -rf trunk
26 26
 	)
27 27
 '
12  t/t9137-git-svn-dcommit-clobber-series.sh
@@ -6,10 +6,10 @@ test_description='git svn dcommit clobber series'
6 6
 
7 7
 test_expect_success 'initialize repo' '
8 8
 	mkdir import &&
9  
-	cd import &&
  9
+	(cd import &&
10 10
 	awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file
11  
-	svn_cmd import -m "initial" . "$svnrepo" &&
12  
-	cd .. &&
  11
+	svn_cmd import -m "initial" . "$svnrepo"
  12
+	) &&
13 13
 	git svn init "$svnrepo" &&
14 14
 	git svn fetch &&
15 15
 	test -e file
@@ -19,14 +19,14 @@ test_expect_success '(supposedly) non-conflicting change from SVN' '
19 19
 	test x"`sed -n -e 58p < file`" = x58 &&
20 20
 	test x"`sed -n -e 61p < file`" = x61 &&
21 21
 	svn_cmd co "$svnrepo" tmp &&
22  
-	cd tmp &&
  22
+	(cd tmp &&
23 23
 		perl -i.bak -p -e "s/^58$/5588/" file &&
24 24
 		perl -i.bak -p -e "s/^61$/6611/" file &&
25 25
 		poke file &&
26 26
 		test x"`sed -n -e 58p < file`" = x5588 &&
27 27
 		test x"`sed -n -e 61p < file`" = x6611 &&
28  
-		svn_cmd commit -m "58 => 5588, 61 => 6611" &&
29  
-		cd ..
  28
+		svn_cmd commit -m "58 => 5588, 61 => 6611"
  29
+	)
30 30
 	'
31 31
 
32 32
 test_expect_success 'some unrelated changes to git' "
5  t/t9300-fast-import.sh
@@ -1056,11 +1056,10 @@ test_expect_success \
1056 1056
 	'P: supermodule & submodule mix' \
1057 1057
 	'git fast-import <input &&
1058 1058
 	 git checkout subuse1 &&
1059  
-	 rm -rf sub && mkdir sub && cd sub &&
  1059
+	 rm -rf sub && mkdir sub && (cd sub &&
1060 1060
 	 git init &&
1061 1061
 	 git fetch --update-head-ok .. refs/heads/sub:refs/heads/master &&
1062  
-	 git checkout master &&
1063  
-	 cd .. &&
  1062
+	 git checkout master) &&
1064 1063
 	 git submodule init &&
1065 1064
 	 git submodule update'
1066 1065
 
53  t/t9401-git-cvsserver-crlf.sh
@@ -129,21 +129,22 @@ test_expect_success 'cvs co (use attributes)' '
129 129
 '
130 130
 
131 131
 test_expect_success 'adding files' '
132  
-    cd cvswork/subdir &&
  132
+    (cd cvswork &&
  133
+    (cd subdir &&
133 134
     echo "more text" > src.c &&
134 135
     GIT_CONFIG="$git_config" cvs -Q add src.c >cvs.log 2>&1 &&
135 136
     marked_as . src.c "" &&
136  
-    echo "psuedo-binary" > temp.bin &&
137  
-    cd .. &&
  137
+    echo "psuedo-binary" > temp.bin
  138
+    ) &&
138 139
     GIT_CONFIG="$git_config" cvs -Q add subdir/temp.bin >cvs.log 2>&1 &&
139 140
     marked_as subdir temp.bin "-kb" &&
140 141
     cd subdir &&
141 142
     GIT_CONFIG="$git_config" cvs -Q ci -m "adding files" >cvs.log 2>&1 &&
142 143
     marked_as . temp.bin "-kb" &&
143 144
     marked_as . src.c ""
  145
+    )
144 146
 '
145 147
 
146  
-cd "$WORKDIR"
147 148
 test_expect_success 'updating' '
148 149
     git pull gitcvs.git &&
149 150
     echo 'hi' > subdir/newfile.bin &&
@@ -153,9 +154,9 @@ test_expect_success 'updating' '
153 154
     git add subdir/newfile.bin subdir/file.h subdir/newfile.c binfile.bin &&
154 155
     git commit -q -m "Add and change some files" &&
155 156
     git push gitcvs.git >/dev/null &&
156  
-    cd cvswork &&
157  
-    GIT_CONFIG="$git_config" cvs -Q update &&
158  
-    cd .. &&
  157
+    (cd cvswork &&
  158
+    GIT_CONFIG="$git_config" cvs -Q update
  159
+    ) &&
159 160
     marked_as cvswork textfile.c "" &&
160 161
     marked_as cvswork binfile.bin -kb &&
161 162
     marked_as cvswork .gitattributes "" &&
@@ -233,35 +234,35 @@ test_expect_success 'cvs co another copy (guess)' '
233 234
 '
234 235
 
235 236
 test_expect_success 'add text (guess)' '
236  
-    cd cvswork &&
  237
+    (cd cvswork &&
237 238
     echo "simpleText" > simpleText.c &&
238  
-    GIT_CONFIG="$git_config" cvs -Q add simpleText.c &&
239  
-    cd .. &&
  239
+    GIT_CONFIG="$git_config" cvs -Q add simpleText.c
  240
+    ) &&
240 241
     marked_as cvswork simpleText.c ""
241 242
 '
242 243
 
243 244
 test_expect_success 'add bin (guess)' '
244  
-    cd cvswork &&
  245
+    (cd cvswork &&
245 246
     echo "simpleBin: NUL: Q <- there" | q_to_nul > simpleBin.bin &&
246  
-    GIT_CONFIG="$git_config" cvs -Q add simpleBin.bin &&
247  
-    cd .. &&
  247
+    GIT_CONFIG="$git_config" cvs -Q add simpleBin.bin
  248
+    ) &&
248 249
     marked_as cvswork simpleBin.bin -kb
249 250
 '
250 251
 
251 252
 test_expect_success 'remove files (guess)' '
252  
-    cd cvswork &&
  253
+    (cd cvswork &&
253 254
     GIT_CONFIG="$git_config" cvs -Q rm -f subdir/file.h &&
254  
-    cd subdir &&
255  
-    GIT_CONFIG="$git_config" cvs -Q rm -f withCr.bin &&
256  
-    cd ../.. &&
  255
+    (cd subdir &&
  256
+    GIT_CONFIG="$git_config" cvs -Q rm -f withCr.bin
  257
+    )) &&
257 258
     marked_as cvswork/subdir withCr.bin -kb &&
258 259
     marked_as cvswork/subdir file.h ""
259 260
 '
260 261
 
261 262
 test_expect_success 'cvs ci (guess)' '
262  
-    cd cvswork &&
263  
-    GIT_CONFIG="$git_config" cvs -Q ci -m "add/rm files" >cvs.log 2>&1 &&
264  
-    cd .. &&
  263
+    (cd cvswork &&
  264
+    GIT_CONFIG="$git_config" cvs -Q ci -m "add/rm files" >cvs.log 2>&1
  265
+    ) &&
265 266
     marked_as cvswork textfile.c "" &&
266 267
     marked_as cvswork binfile.bin -kb &&
267 268
     marked_as cvswork .gitattributes "" &&
@@ -278,9 +279,9 @@ test_expect_success 'cvs ci (guess)' '
278 279
 '
279 280
 
280 281
 test_expect_success 'update subdir of other copy (guess)' '
281  
-    cd cvswork2/subdir &&
282  
-    GIT_CONFIG="$git_config" cvs -Q update &&
283  
-    cd ../.. &&
  282
+    (cd cvswork2/subdir &&
  283
+    GIT_CONFIG="$git_config" cvs -Q update
  284
+    ) &&
284 285
     marked_as cvswork2 textfile.c "" &&
285 286
     marked_as cvswork2 binfile.bin -kb &&
286 287
     marked_as cvswork2 .gitattributes "" &&
@@ -304,11 +305,11 @@ test_expect_success 'update/merge full other copy (guess)' '
304 305
     git add multilineTxt.c &&
305 306
     git commit -q -m "modify multiline file" >> "${WORKDIR}/marked.log" &&
306 307
     git push gitcvs.git >/dev/null &&
307  
-    cd cvswork2 &&
  308
+    (cd cvswork2 &&
308 309
     sed "s/1/replaced_1/" < multilineTxt.c > ml.temp &&
309 310
     mv ml.temp multilineTxt.c &&
310  
-    GIT_CONFIG="$git_config" cvs update > cvs.log 2>&1 &&
311  
-    cd .. &&
  311
+    GIT_CONFIG="$git_config" cvs update > cvs.log 2>&1
  312
+    ) &&
312 313
     marked_as cvswork2 textfile.c "" &&
313 314
     marked_as cvswork2 binfile.bin -kb &&
314 315
     marked_as cvswork2 .gitattributes "" &&
38  t/t9600-cvsimport.sh
@@ -17,7 +17,7 @@ test_expect_success 'setup a cvs module' '
17 17
 
18 18
 	mkdir "$CVSROOT/module" &&
19 19
 	$CVS co -d module-cvs module &&
20  
-	cd module-cvs &&
  20
+	(cd module-cvs &&
21 21
 	cat <<EOF >o_fortuna &&
22 22
 O Fortuna
23 23
 velut luna
@@ -41,8 +41,8 @@ add "O Fortuna" lyrics