git-svn: quiet down tests and fix some unportable shell constructs
The latest changes to git-commit have made it more verbose; and I was running the setup of the tests outside of the test_expect_*, so errors in those were not caught. Now we move them to where they can be eval'ed and have their output trapped. export var=value has been removed Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Dec 26, 2006 at 16:27 UTC
39ed7c181b7a8f5e28cffcaca9369e6ebc74a055
1 file changed
+127
-131
t/t9100-git-svn-basic.sh
+127
-131
@@ -19,180 +19,176 @@ esac
19
20
echo 'define NO_SVN_TESTS to skip git-svn tests'
21
22
-mkdir import
23
-cd import
24
-
25
-echo foo > foo
26
-if test -z "$NO_SYMLINK"
27
-then
28
- ln -s foo foo.link
29
-fi
30
-mkdir -p dir/a/b/c/d/e
31
-echo 'deep dir' > dir/a/b/c/d/e/file
32
-mkdir -p bar
33
-echo 'zzz' > bar/zzz
34
-echo '#!/bin/sh' > exec.sh
35
-chmod +x exec.sh
36
-svn import -m 'import for git-svn' . "$svnrepo" >/dev/null
37
-
38
-cd ..
39
-rm -rf import
40
-
22
test_expect_success \
42
- 'initialize git-svn' \
43
- "git-svn init $svnrepo"
23
+ 'initialize git-svn' "
24
+ mkdir import &&
25
+ cd import &&
26
+ echo foo > foo &&
27
+ if test -z '$NO_SYMLINK'
28
+ then
29
+ ln -s foo foo.link
30
+ fi
31
+ mkdir -p dir/a/b/c/d/e &&
32
+ echo 'deep dir' > dir/a/b/c/d/e/file &&
33
+ mkdir bar &&
34
+ echo 'zzz' > bar/zzz &&
35
+ echo '#!/bin/sh' > exec.sh &&
36
+ chmod +x exec.sh &&
37
+ svn import -m 'import for git-svn' . $svnrepo >/dev/null &&
38
+ cd .. &&
39
+ rm -rf import &&
40
+ git-svn init $svnrepo"
41
42
test_expect_success \
43
'import an SVN revision into git' \
44
'git-svn fetch'
45
49
-test_expect_success "checkout from svn" "svn co $svnrepo $SVN_TREE"
46
+test_expect_success "checkout from svn" "svn co $svnrepo '$SVN_TREE'"
47
48
name='try a deep --rmdir with a commit'
52
-git checkout -f -b mybranch remotes/git-svn
53
-mv dir/a/b/c/d/e/file dir/file
54
-cp dir/file file
55
-git update-index --add --remove dir/a/b/c/d/e/file dir/file file
56
-git commit -m "$name"
57
-
58
-test_expect_success "$name" \
59
- "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch &&
60
- svn up $SVN_TREE &&
61
- test -d $SVN_TREE/dir && test ! -d $SVN_TREE/dir/a"
49
+test_expect_success "$name" "
50
+ git checkout -f -b mybranch remotes/git-svn &&
51
+ mv dir/a/b/c/d/e/file dir/file &&
52
+ cp dir/file file &&
53
+ git update-index --add --remove dir/a/b/c/d/e/file dir/file file &&
54
+ git commit -m '$name' &&
55
+ git-svn set-tree --find-copies-harder --rmdir \
56
+ remotes/git-svn..mybranch &&
57
+ svn up '$SVN_TREE' &&
58
+ test -d '$SVN_TREE'/dir && test ! -d '$SVN_TREE'/dir/a"
59
60
61
name='detect node change from file to directory #1'
65
-mkdir dir/new_file
66
-mv dir/file dir/new_file/file
67
-mv dir/new_file dir/file
68
-git update-index --remove dir/file
69
-git update-index --add dir/file/file
70
-git commit -m "$name"
71
-
72
-test_expect_failure "$name" \
73
- 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch' \
74
- || true
62
+test_expect_failure "$name" "
63
+ mkdir dir/new_file &&
64
+ mv dir/file dir/new_file/file &&
65
+ mv dir/new_file dir/file &&
66
+ git update-index --remove dir/file &&
67
+ git update-index --add dir/file/file &&
68
+ git commit -m '$name' &&
69
+ git-svn set-tree --find-copies-harder --rmdir \
70
+ remotes/git-svn..mybranch" || true
71
72
73
name='detect node change from directory to file #1'
78
-rm -rf dir $GIT_DIR/index
79
-git checkout -f -b mybranch2 remotes/git-svn
80
-mv bar/zzz zzz
81
-rm -rf bar
82
-mv zzz bar
83
-git update-index --remove -- bar/zzz
84
-git update-index --add -- bar
85
-git commit -m "$name"
86
-
87
-test_expect_failure "$name" \
88
- 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch2' \
89
- || true
74
+test_expect_failure "$name" "
75
+ rm -rf dir '$GIT_DIR'/index &&
76
+ git checkout -f -b mybranch2 remotes/git-svn &&
77
+ mv bar/zzz zzz &&
78
+ rm -rf bar &&
79
+ mv zzz bar &&
80
+ git update-index --remove -- bar/zzz &&
81
+ git update-index --add -- bar &&
82
+ git commit -m '$name' &&
83
+ git-svn set-tree --find-copies-harder --rmdir \
84
+ remotes/git-svn..mybranch2" || true
85
86
87
name='detect node change from file to directory #2'
93
-rm -f $GIT_DIR/index
94
-git checkout -f -b mybranch3 remotes/git-svn
95
-rm bar/zzz
96
-git-update-index --remove bar/zzz
97
-mkdir bar/zzz
98
-echo yyy > bar/zzz/yyy
99
-git-update-index --add bar/zzz/yyy
100
-git commit -m "$name"
101
-
102
-test_expect_failure "$name" \
103
- 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch3' \
104
- || true
88
+test_expect_failure "$name" "
89
+ rm -f '$GIT_DIR'/index &&
90
+ git checkout -f -b mybranch3 remotes/git-svn &&
91
+ rm bar/zzz &&
92
+ git-update-index --remove bar/zzz &&
93
+ mkdir bar/zzz &&
94
+ echo yyy > bar/zzz/yyy &&
95
+ git-update-index --add bar/zzz/yyy &&
96
+ git commit -m '$name' &&
97
+ git-svn set-tree --find-copies-harder --rmdir \
98
+ remotes/git-svn..mybranch3" || true
99
100
101
name='detect node change from directory to file #2'
108
-rm -f $GIT_DIR/index
109
-git checkout -f -b mybranch4 remotes/git-svn
110
-rm -rf dir
111
-git update-index --remove -- dir/file
112
-touch dir
113
-echo asdf > dir
114
-git update-index --add -- dir
115
-git commit -m "$name"
116
-
117
-test_expect_failure "$name" \
118
- 'git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch4' \
119
- || true
102
+test_expect_failure "$name" "
103
+ rm -f '$GIT_DIR'/index &&
104
+ git checkout -f -b mybranch4 remotes/git-svn &&
105
+ rm -rf dir &&
106
+ git update-index --remove -- dir/file &&
107
+ touch dir &&
108
+ echo asdf > dir &&
109
+ git update-index --add -- dir &&
110
+ git commit -m '$name' &&
111
+ git-svn set-tree --find-copies-harder --rmdir \
112
+ remotes/git-svn..mybranch4" || true
113
114
115
name='remove executable bit from a file'
123
-rm -f $GIT_DIR/index
124
-git checkout -f -b mybranch5 remotes/git-svn
125
-chmod -x exec.sh
126
-git update-index exec.sh
127
-git commit -m "$name"
128
-
129
-test_expect_success "$name" \
130
- "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
131
- svn up $SVN_TREE &&
132
- test ! -x $SVN_TREE/exec.sh"
116
+test_expect_success "$name" "
117
+ rm -f '$GIT_DIR'/index &&
118
+ git checkout -f -b mybranch5 remotes/git-svn &&
119
+ chmod -x exec.sh &&
120
+ git update-index exec.sh &&
121
+ git commit -m '$name' &&
122
+ git-svn set-tree --find-copies-harder --rmdir \
123
+ remotes/git-svn..mybranch5 &&
124
+ svn up '$SVN_TREE' &&
125
+ test ! -x '$SVN_TREE'/exec.sh"
126
127
128
name='add executable bit back file'
136
-chmod +x exec.sh
137
-git update-index exec.sh
138
-git commit -m "$name"
139
-
140
-test_expect_success "$name" \
141
- "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
142
- svn up $SVN_TREE &&
143
- test -x $SVN_TREE/exec.sh"
144
-
129
+test_expect_success "$name" "
130
+ chmod +x exec.sh &&
131
+ git update-index exec.sh &&
132
+ git commit -m '$name' &&
133
+ git-svn set-tree --find-copies-harder --rmdir \
134
+ remotes/git-svn..mybranch5 &&
135
+ svn up '$SVN_TREE' &&
136
+ test -x '$SVN_TREE'/exec.sh"
137
138
139
if test -z "$NO_SYMLINK"
140
then
141
name='executable file becomes a symlink to bar/zzz (file)'
150
- rm exec.sh
151
- ln -s bar/zzz exec.sh
152
- git update-index exec.sh
153
- git commit -m "$name"
142
155
- test_expect_success "$name" \
156
- "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
157
- svn up $SVN_TREE &&
158
- test -L $SVN_TREE/exec.sh"
143
+ test_expect_success "$name" "
144
+ rm exec.sh &&
145
+ ln -s bar/zzz exec.sh &&
146
+ git update-index exec.sh &&
147
+ git commit -m '$name' &&
148
+ git-svn set-tree --find-copies-harder --rmdir \
149
+ remotes/git-svn..mybranch5 &&
150
+ svn up '$SVN_TREE' &&
151
+ test -L '$SVN_TREE'/exec.sh"
152
153
name='new symlink is added to a file that was also just made executable'
161
- chmod +x bar/zzz
162
- ln -s bar/zzz exec-2.sh
163
- git update-index --add bar/zzz exec-2.sh
164
- git commit -m "$name"
154
166
- test_expect_success "$name" \
167
- "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
168
- svn up $SVN_TREE &&
169
- test -x $SVN_TREE/bar/zzz &&
170
- test -L $SVN_TREE/exec-2.sh"
155
+ test_expect_success "$name" "
156
+ chmod +x bar/zzz &&
157
+ ln -s bar/zzz exec-2.sh &&
158
+ git update-index --add bar/zzz exec-2.sh &&
159
+ git commit -m '$name' &&
160
+ git-svn set-tree --find-copies-harder --rmdir \
161
+ remotes/git-svn..mybranch5 &&
162
+ svn up '$SVN_TREE' &&
163
+ test -x '$SVN_TREE'/bar/zzz &&
164
+ test -L '$SVN_TREE'/exec-2.sh"
165
166
name='modify a symlink to become a file'
173
- echo git help > help || true
174
- rm exec-2.sh
175
- cp help exec-2.sh
176
- git update-index exec-2.sh
177
- git commit -m "$name"
178
-
179
- test_expect_success "$name" \
180
- "git-svn set-tree --find-copies-harder --rmdir remotes/git-svn..mybranch5 &&
181
- svn up $SVN_TREE &&
182
- test -f $SVN_TREE/exec-2.sh &&
183
- test ! -L $SVN_TREE/exec-2.sh &&
184
- diff -u help $SVN_TREE/exec-2.sh"
167
+ test_expect_success "$name" "
168
+ echo git help > help || true &&
169
+ rm exec-2.sh &&
170
+ cp help exec-2.sh &&
171
+ git update-index exec-2.sh &&
172
+ git commit -m '$name' &&
173
+ git-svn set-tree --find-copies-harder --rmdir \
174
+ remotes/git-svn..mybranch5 &&
175
+ svn up '$SVN_TREE' &&
176
+ test -f '$SVN_TREE'/exec-2.sh &&
177
+ test ! -L '$SVN_TREE'/exec-2.sh &&
178
+ diff -u help $SVN_TREE/exec-2.sh"
179
fi
180
181
182
if test "$have_utf8" = t
183
then
184
name="commit with UTF-8 message: locale: $GIT_SVN_LC_ALL"
191
- echo '# hello' >> exec-2.sh
192
- git update-index exec-2.sh
193
- git commit -m 'éï∏'
194
- export LC_ALL="$GIT_SVN_LC_ALL"
195
- test_expect_success "$name" "git-svn set-tree HEAD"
185
+ LC_ALL="$GIT_SVN_LC_ALL"
186
+ export LC_ALL
187
+ test_expect_success "$name" "
188
+ echo '# hello' >> exec-2.sh &&
189
+ git update-index exec-2.sh &&
190
+ git commit -m 'éï∏' &&
191
+ git-svn set-tree HEAD"
192
unset LC_ALL
193
else
194
echo "UTF-8 locale not set, test skipped ($GIT_SVN_LC_ALL)"