Skip to content

Commit da083d6

Browse files
Eygene RyabinkinEric Wong
authored andcommitted
git-svn testsuite: use standard configuration for Subversion tools
I have tweaked configuration in my ~/.subversion directory, namely I am running auto-properties and automatically adding '$Id$' expansion to every file. This choke the last test named 'proplist' from t9101-git-svn-props.sh, because one more property, svn:keywords is automatically added. I had just wrapped svn invocation with the svn_cmd that specifies empty directory via --config-dir argument. Since the latter is the global option, it should be recognized by all svn subcommands, so no regressions will be introduced. Now svn_cmd is used everywhere, not just in the failed test module: this should guard us from the future clashes with user-defined configuration tweaks. Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru> Acked-by: Eric Wong <normalperson@yhbt.net>
1 parent 065b070 commit da083d6

29 files changed

+221
-206
lines changed

t/lib-git-svn.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ fi
2626

2727
svnrepo=$PWD/svnrepo
2828
export svnrepo
29+
svnconf=$PWD/svnconf
30+
export svnconf
2931

3032
perl -w -e "
3133
use SVN::Core;
@@ -54,6 +56,19 @@ poke() {
5456
test-chmtime +1 "$1"
5557
}
5658

59+
# We need this, because we should pass empty configuration directory to
60+
# the 'svn commit' to avoid automated property changes and other stuff
61+
# that could be set from user's configuration files in ~/.subversion.
62+
svn_cmd () {
63+
[ -d "$svnconf" ] || mkdir "$svnconf"
64+
orig_svncmd="$1"; shift
65+
if [ -z "$orig_svncmd" ]; then
66+
svn
67+
return
68+
fi
69+
svn "$orig_svncmd" --config-dir "$svnconf" "$@"
70+
}
71+
5772
for d in \
5873
"$SVN_HTTPD_PATH" \
5974
/usr/sbin/apache2 \

t/t9100-git-svn-basic.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ test_expect_success \
3131
echo "zzz" > bar/zzz &&
3232
echo "#!/bin/sh" > exec.sh &&
3333
chmod +x exec.sh &&
34-
svn import -m "import for git svn" . "$svnrepo" >/dev/null &&
34+
svn_cmd import -m "import for git svn" . "$svnrepo" >/dev/null &&
3535
cd .. &&
3636
rm -rf import &&
3737
git svn init "$svnrepo"'
@@ -51,7 +51,7 @@ test_expect_success "$name" '
5151
git commit -m "$name" &&
5252
git svn set-tree --find-copies-harder --rmdir \
5353
${remotes_git_svn}..mybranch &&
54-
svn up "$SVN_TREE" &&
54+
svn_cmd up "$SVN_TREE" &&
5555
test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a'
5656

5757

@@ -118,7 +118,7 @@ test_expect_success "$name" '
118118
git commit -m "$name" &&
119119
git svn set-tree --find-copies-harder --rmdir \
120120
${remotes_git_svn}..mybranch5 &&
121-
svn up "$SVN_TREE" &&
121+
svn_cmd up "$SVN_TREE" &&
122122
test ! -x "$SVN_TREE"/exec.sh'
123123

124124

@@ -129,7 +129,7 @@ test_expect_success "$name" '
129129
git commit -m "$name" &&
130130
git svn set-tree --find-copies-harder --rmdir \
131131
${remotes_git_svn}..mybranch5 &&
132-
svn up "$SVN_TREE" &&
132+
svn_cmd up "$SVN_TREE" &&
133133
test -x "$SVN_TREE"/exec.sh'
134134

135135

@@ -141,7 +141,7 @@ test_expect_success "$name" '
141141
git commit -m "$name" &&
142142
git svn set-tree --find-copies-harder --rmdir \
143143
${remotes_git_svn}..mybranch5 &&
144-
svn up "$SVN_TREE" &&
144+
svn_cmd up "$SVN_TREE" &&
145145
test -L "$SVN_TREE"/exec.sh'
146146

147147
name='new symlink is added to a file that was also just made executable'
@@ -153,7 +153,7 @@ test_expect_success "$name" '
153153
git commit -m "$name" &&
154154
git svn set-tree --find-copies-harder --rmdir \
155155
${remotes_git_svn}..mybranch5 &&
156-
svn up "$SVN_TREE" &&
156+
svn_cmd up "$SVN_TREE" &&
157157
test -x "$SVN_TREE"/bar/zzz &&
158158
test -L "$SVN_TREE"/exec-2.sh'
159159

@@ -166,7 +166,7 @@ test_expect_success "$name" '
166166
git commit -m "$name" &&
167167
git svn set-tree --find-copies-harder --rmdir \
168168
${remotes_git_svn}..mybranch5 &&
169-
svn up "$SVN_TREE" &&
169+
svn_cmd up "$SVN_TREE" &&
170170
test -f "$SVN_TREE"/exec-2.sh &&
171171
test ! -L "$SVN_TREE"/exec-2.sh &&
172172
test_cmp help "$SVN_TREE"/exec-2.sh'

t/t9101-git-svn-props.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ EOF
4848
printf "\r\n" > empty_crlf
4949
a_empty_crlf=`git hash-object -w empty_crlf`
5050

51-
svn import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
51+
svn_cmd import --no-auto-props -m 'import for git svn' . "$svnrepo" >/dev/null
5252
cd ..
5353

5454
rm -rf import
@@ -57,13 +57,13 @@ test_expect_success 'setup some commits to svn' \
5757
'cd test_wc &&
5858
echo Greetings >> kw.c &&
5959
poke kw.c &&
60-
svn commit -m "Not yet an Id" &&
60+
svn_cmd commit -m "Not yet an Id" &&
6161
echo Hello world >> kw.c &&
6262
poke kw.c &&
63-
svn commit -m "Modified file, but still not yet an Id" &&
64-
svn propset svn:keywords Id kw.c &&
63+
svn_cmd commit -m "Modified file, but still not yet an Id" &&
64+
svn_cmd propset svn:keywords Id kw.c &&
6565
poke kw.c &&
66-
svn commit -m "Propset Id" &&
66+
svn_cmd commit -m "Propset Id" &&
6767
cd ..'
6868

6969
test_expect_success 'initialize git svn' 'git svn init "$svnrepo"'
@@ -83,16 +83,16 @@ test_expect_success 'raw $Id$ found in kw.c' "test '$expect' = '$got'"
8383

8484
test_expect_success "propset CR on crlf files" \
8585
'cd test_wc &&
86-
svn propset svn:eol-style CR empty &&
87-
svn propset svn:eol-style CR crlf &&
88-
svn propset svn:eol-style CR ne_crlf &&
89-
svn commit -m "propset CR on crlf files" &&
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" &&
9090
cd ..'
9191

9292
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
9393
'git svn fetch &&
9494
git pull . ${remotes_git_svn} &&
95-
svn co "$svnrepo" new_wc'
95+
svn_cmd co "$svnrepo" new_wc'
9696

9797
for i in crlf ne_crlf lf ne_lf cr ne_cr empty_cr empty_lf empty empty_crlf
9898
do
@@ -106,11 +106,11 @@ cd test_wc
106106
a_cr=`printf '$Id$\r\nHello\r\nWorld\r\n' | git hash-object --stdin`
107107
a_ne_cr=`printf '$Id$\r\nHello\r\nWorld' | git hash-object --stdin`
108108
test_expect_success 'Set CRLF on cr files' \
109-
'svn propset svn:eol-style CRLF cr &&
110-
svn propset svn:eol-style CRLF ne_cr &&
111-
svn propset svn:keywords Id cr &&
112-
svn propset svn:keywords Id ne_cr &&
113-
svn commit -m "propset CRLF on cr files"'
109+
'svn_cmd propset svn:eol-style CRLF cr &&
110+
svn_cmd propset svn:eol-style CRLF ne_cr &&
111+
svn_cmd propset svn:keywords Id cr &&
112+
svn_cmd propset svn:keywords Id ne_cr &&
113+
svn_cmd commit -m "propset CRLF on cr files"'
114114
cd ..
115115
test_expect_success 'fetch and pull latest from svn' \
116116
'git svn fetch && git pull . ${remotes_git_svn}'
@@ -140,10 +140,10 @@ test_expect_success 'test show-ignore' "
140140
cd test_wc &&
141141
mkdir -p deeply/nested/directory &&
142142
touch deeply/nested/directory/.keep &&
143-
svn add deeply &&
144-
svn up &&
145-
svn propset -R svn:ignore 'no-such-file*' .
146-
svn commit -m 'propset svn:ignore'
143+
svn_cmd add deeply &&
144+
svn_cmd up &&
145+
svn_cmd propset -R svn:ignore 'no-such-file*' .
146+
svn_cmd commit -m 'propset svn:ignore'
147147
cd .. &&
148148
git svn show-ignore > show-ignore.got &&
149149
cmp show-ignore.expect show-ignore.got

t/t9102-git-svn-deep-rmdir.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test_expect_success 'initialize repo' '
99
mkdir -p deeply/nested/directory/number/2 &&
1010
echo foo > deeply/nested/directory/number/1/file &&
1111
echo foo > deeply/nested/directory/number/2/another &&
12-
svn import -m "import for git svn" . "$svnrepo" &&
12+
svn_cmd import -m "import for git svn" . "$svnrepo" &&
1313
cd ..
1414
'
1515

@@ -23,7 +23,7 @@ test_expect_success 'Try a commit on rmdir' '
2323
git rm -f deeply/nested/directory/number/2/another &&
2424
git commit -a -m "remove another" &&
2525
git svn set-tree --rmdir HEAD &&
26-
svn ls -R "$svnrepo" | grep ^deeply/nested/directory/number/1
26+
svn_cmd ls -R "$svnrepo" | grep ^deeply/nested/directory/number/1
2727
'
2828

2929

t/t9103-git-svn-tracked-directory-removed.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ test_expect_success 'make history for tracking' '
1010
mkdir import &&
1111
mkdir import/trunk &&
1212
echo hello >> import/trunk/README &&
13-
svn import -m initial import "$svnrepo" &&
13+
svn_cmd import -m initial import "$svnrepo" &&
1414
rm -rf import &&
15-
svn co "$svnrepo"/trunk trunk &&
15+
svn_cmd co "$svnrepo"/trunk trunk &&
1616
echo bye bye >> trunk/README &&
17-
svn rm -m "gone" "$svnrepo"/trunk &&
17+
svn_cmd rm -m "gone" "$svnrepo"/trunk &&
1818
rm -rf trunk &&
1919
mkdir trunk &&
2020
echo "new" > trunk/FOLLOWME &&
21-
svn import -m "new trunk" trunk "$svnrepo"/trunk
21+
svn_cmd import -m "new trunk" trunk "$svnrepo"/trunk
2222
'
2323

2424
test_expect_success 'clone repo with git' '

t/t9104-git-svn-follow-parent.sh

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ test_expect_success 'initialize repo' '
1111
cd import &&
1212
mkdir -p trunk &&
1313
echo hello > trunk/readme &&
14-
svn import -m "initial" . "$svnrepo" &&
14+
svn_cmd import -m "initial" . "$svnrepo" &&
1515
cd .. &&
16-
svn co "$svnrepo" wc &&
16+
svn_cmd co "$svnrepo" wc &&
1717
cd wc &&
1818
echo world >> trunk/readme &&
1919
poke trunk/readme &&
20-
svn commit -m "another commit" &&
21-
svn up &&
22-
svn mv trunk thunk &&
20+
svn_cmd commit -m "another commit" &&
21+
svn_cmd up &&
22+
svn_cmd mv trunk thunk &&
2323
echo goodbye >> thunk/readme &&
2424
poke thunk/readme &&
25-
svn commit -m "bye now" &&
25+
svn_cmd commit -m "bye now" &&
2626
cd ..
2727
'
2828

@@ -51,7 +51,7 @@ test_expect_success 'init and fetch from one svn-remote' '
5151
'
5252

5353
test_expect_success 'follow deleted parent' '
54-
(svn cp -m "resurrecting trunk as junk" \
54+
(svn_cmd cp -m "resurrecting trunk as junk" \
5555
"$svnrepo"/trunk@2 "$svnrepo"/junk ||
5656
svn cp -m "resurrecting trunk as junk" \
5757
-r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
@@ -97,8 +97,8 @@ test_expect_success 'follow higher-level parent' '
9797
'
9898

9999
test_expect_success 'follow deleted directory' '
100-
svn mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye &&
101-
svn rm -m "remove glob" "$svnrepo"/glob &&
100+
svn_cmd mv -m "bye!" "$svnrepo"/glob/blob/hi "$svnrepo"/glob/blob/bye &&
101+
svn_cmd rm -m "remove glob" "$svnrepo"/glob &&
102102
git svn init --minimize-url -i glob "$svnrepo"/glob &&
103103
git svn fetch -i glob &&
104104
test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi &&
@@ -120,7 +120,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
120120
cd import &&
121121
svn import -m "r9270 test" . "$svnrepo"/r9270 &&
122122
cd .. &&
123-
svn co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
123+
svn_cmd co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
124124
cd r9270 &&
125125
svn mkdir native &&
126126
svn mv t native/t &&
@@ -138,7 +138,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' '
138138
'
139139

140140
test_expect_success "track initial change if it was only made to parent" '
141-
svn cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk &&
141+
svn_cmd cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk &&
142142
git svn init --minimize-url -i r9270-d \
143143
"$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
144144
git svn fetch -i r9270-d &&
@@ -152,20 +152,20 @@ test_expect_success "track initial change if it was only made to parent" '
152152
test_expect_success "follow-parent is atomic" '
153153
(
154154
cd wc &&
155-
svn up &&
156-
svn mkdir stunk &&
155+
svn_cmd up &&
156+
svn_cmd mkdir stunk &&
157157
echo "trunk stunk" > stunk/readme &&
158-
svn add stunk/readme &&
159-
svn ci -m "trunk stunk" &&
158+
svn_cmd add stunk/readme &&
159+
svn_cmd ci -m "trunk stunk" &&
160160
echo "stunk like junk" >> stunk/readme &&
161-
svn ci -m "really stunk" &&
161+
svn_cmd ci -m "really stunk" &&
162162
echo "stink stank stunk" >> stunk/readme &&
163-
svn ci -m "even the grinch agrees"
163+
svn_cmd ci -m "even the grinch agrees"
164164
) &&
165-
svn copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
165+
svn_cmd copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
166166
{ svn cp -m "early stunk flunked too" \
167167
"$svnrepo"/stunk@17 "$svnrepo"/flunked ||
168-
svn cp -m "early stunk flunked too" \
168+
svn_cmd cp -m "early stunk flunked too" \
169169
-r17 "$svnrepo"/stunk "$svnrepo"/flunked; } &&
170170
git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
171171
git svn fetch -i stunk &&
@@ -192,7 +192,7 @@ test_expect_success "follow-parent is atomic" '
192192
'
193193

194194
test_expect_success "track multi-parent paths" '
195-
svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
195+
svn_cmd cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
196196
git svn multi-fetch &&
197197
test `git cat-file commit refs/remotes/glob | \
198198
grep "^parent " | wc -l` -eq 2

t/t9105-git-svn-commit-diff.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test_expect_success 'initialize repo' '
88
mkdir import &&
99
cd import &&
1010
echo hello > readme &&
11-
svn import -m "initial" . "$svnrepo" &&
11+
svn_cmd import -m "initial" . "$svnrepo" &&
1212
cd .. &&
1313
echo hello > readme &&
1414
git update-index --add readme &&
@@ -27,16 +27,16 @@ prev=`git rev-parse --verify HEAD^1`
2727
test_expect_success 'test the commit-diff command' '
2828
test -n "$prev" && test -n "$head" &&
2929
git svn commit-diff -r1 "$prev" "$head" "$svnrepo" &&
30-
svn co "$svnrepo" wc &&
30+
svn_cmd co "$svnrepo" wc &&
3131
cmp readme wc/readme
3232
'
3333

3434
test_expect_success 'commit-diff to a sub-directory (with git svn config)' '
35-
svn import -m "sub-directory" import "$svnrepo"/subdir &&
35+
svn_cmd import -m "sub-directory" import "$svnrepo"/subdir &&
3636
git svn init --minimize-url "$svnrepo"/subdir &&
3737
git svn fetch &&
3838
git svn commit-diff -r3 "$prev" "$head" &&
39-
svn cat "$svnrepo"/subdir/readme > readme.2 &&
39+
svn_cmd cat "$svnrepo"/subdir/readme > readme.2 &&
4040
cmp readme readme.2
4141
'
4242

t/t9106-git-svn-commit-diff-clobber.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ test_expect_success 'initialize repo' '
88
mkdir import &&
99
cd import &&
1010
echo initial > file &&
11-
svn import -m "initial" . "$svnrepo" &&
11+
svn_cmd import -m "initial" . "$svnrepo" &&
1212
cd .. &&
1313
echo initial > file &&
1414
git update-index --add file &&
1515
git commit -a -m "initial"
1616
'
1717
test_expect_success 'commit change from svn side' '
18-
svn co "$svnrepo" t.svn &&
18+
svn_cmd co "$svnrepo" t.svn &&
1919
cd t.svn &&
2020
echo second line from svn >> file &&
2121
poke file &&
22-
svn commit -m "second line from svn" &&
22+
svn_cmd commit -m "second line from svn" &&
2323
cd .. &&
2424
rm -rf t.svn
2525
'
@@ -43,11 +43,11 @@ test_expect_success 'dcommit fails to commit because of conflict' '
4343
git svn init "$svnrepo" &&
4444
git svn fetch &&
4545
git reset --hard refs/${remotes_git_svn} &&
46-
svn co "$svnrepo" t.svn &&
46+
svn_cmd co "$svnrepo" t.svn &&
4747
cd t.svn &&
4848
echo fourth line from svn >> file &&
4949
poke file &&
50-
svn commit -m "fourth line from svn" &&
50+
svn_cmd commit -m "fourth line from svn" &&
5151
cd .. &&
5252
rm -rf t.svn &&
5353
echo "fourth line from git" >> file &&
@@ -67,11 +67,11 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' "
6767
"
6868

6969
test_expect_success 'commit another change from svn side' '
70-
svn co "$svnrepo" t.svn &&
70+
svn_cmd co "$svnrepo" t.svn &&
7171
cd t.svn &&
7272
echo third line from svn >> file &&
7373
poke file &&
74-
svn commit -m "third line from svn" &&
74+
svn_cmd commit -m "third line from svn" &&
7575
cd .. &&
7676
rm -rf t.svn
7777
'

t/t9107-git-svn-migrate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test_expect_success 'setup old-looking metadata' '
1212
mkdir -p $i && \
1313
echo hello >> $i/README || exit 1
1414
done && \
15-
svn import -m test . "$svnrepo"
15+
svn_cmd import -m test . "$svnrepo"
1616
cd .. &&
1717
git svn init "$svnrepo" &&
1818
git svn fetch &&

0 commit comments

Comments
 (0)