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