Skip to content

Commit 16805d3

Browse files
Nanako Shiraishigitster
authored andcommitted
t/t91XX-svn: start removing use of "git-" from these tests
Subversion tests use too many "git-foo" form, so I am converting them in two steps. This first step replaces literal strings "remotes/git-svn" and "git-svn-id" by introducing $remotes_git_svn and $git_svn_id constants defined as shell variables. This will reduce the number of false hits from "git grep". Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 24fa13c commit 16805d3

10 files changed

+58
-55
lines changed

t/lib-git-svn.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
. ./test-lib.sh
22

3+
remotes_git_svn=remotes/git""-svn
4+
git_svn_id=git""-svn-id
5+
36
if test -n "$NO_SVN_TESTS"
47
then
58
test_expect_success 'skipping git-svn tests, NO_SVN_TESTS defined' :

t/t9100-git-svn-basic.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ test_expect_success "checkout from svn" 'svn co "$svnrepo" "$SVN_TREE"'
4444

4545
name='try a deep --rmdir with a commit'
4646
test_expect_success "$name" '
47-
git checkout -f -b mybranch remotes/git-svn &&
47+
git checkout -f -b mybranch ${remotes_git_svn} &&
4848
mv dir/a/b/c/d/e/file dir/file &&
4949
cp dir/file file &&
5050
git update-index --add --remove dir/a/b/c/d/e/file dir/file file &&
5151
git commit -m "$name" &&
5252
git-svn set-tree --find-copies-harder --rmdir \
53-
remotes/git-svn..mybranch &&
53+
${remotes_git_svn}..mybranch &&
5454
svn up "$SVN_TREE" &&
5555
test -d "$SVN_TREE"/dir && test ! -d "$SVN_TREE"/dir/a'
5656

@@ -64,60 +64,60 @@ test_expect_success "$name" "
6464
git update-index --add dir/file/file &&
6565
git commit -m '$name' &&
6666
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
67-
remotes/git-svn..mybranch" || true
67+
${remotes_git_svn}..mybranch" || true
6868

6969

7070
name='detect node change from directory to file #1'
7171
test_expect_success "$name" '
7272
rm -rf dir "$GIT_DIR"/index &&
73-
git checkout -f -b mybranch2 remotes/git-svn &&
73+
git checkout -f -b mybranch2 ${remotes_git_svn} &&
7474
mv bar/zzz zzz &&
7575
rm -rf bar &&
7676
mv zzz bar &&
7777
git update-index --remove -- bar/zzz &&
7878
git update-index --add -- bar &&
7979
git commit -m "$name" &&
8080
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
81-
remotes/git-svn..mybranch2' || true
81+
${remotes_git_svn}..mybranch2' || true
8282

8383

8484
name='detect node change from file to directory #2'
8585
test_expect_success "$name" '
8686
rm -f "$GIT_DIR"/index &&
87-
git checkout -f -b mybranch3 remotes/git-svn &&
87+
git checkout -f -b mybranch3 ${remotes_git_svn} &&
8888
rm bar/zzz &&
8989
git update-index --remove bar/zzz &&
9090
mkdir bar/zzz &&
9191
echo yyy > bar/zzz/yyy &&
9292
git update-index --add bar/zzz/yyy &&
9393
git commit -m "$name" &&
9494
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
95-
remotes/git-svn..mybranch3' || true
95+
${remotes_git_svn}..mybranch3' || true
9696

9797

9898
name='detect node change from directory to file #2'
9999
test_expect_success "$name" '
100100
rm -f "$GIT_DIR"/index &&
101-
git checkout -f -b mybranch4 remotes/git-svn &&
101+
git checkout -f -b mybranch4 ${remotes_git_svn} &&
102102
rm -rf dir &&
103103
git update-index --remove -- dir/file &&
104104
touch dir &&
105105
echo asdf > dir &&
106106
git update-index --add -- dir &&
107107
git commit -m "$name" &&
108108
test_must_fail git-svn set-tree --find-copies-harder --rmdir \
109-
remotes/git-svn..mybranch4' || true
109+
${remotes_git_svn}..mybranch4' || true
110110

111111

112112
name='remove executable bit from a file'
113113
test_expect_success "$name" '
114114
rm -f "$GIT_DIR"/index &&
115-
git checkout -f -b mybranch5 remotes/git-svn &&
115+
git checkout -f -b mybranch5 ${remotes_git_svn} &&
116116
chmod -x exec.sh &&
117117
git update-index exec.sh &&
118118
git commit -m "$name" &&
119119
git-svn set-tree --find-copies-harder --rmdir \
120-
remotes/git-svn..mybranch5 &&
120+
${remotes_git_svn}..mybranch5 &&
121121
svn up "$SVN_TREE" &&
122122
test ! -x "$SVN_TREE"/exec.sh'
123123

@@ -128,7 +128,7 @@ test_expect_success "$name" '
128128
git update-index exec.sh &&
129129
git commit -m "$name" &&
130130
git-svn set-tree --find-copies-harder --rmdir \
131-
remotes/git-svn..mybranch5 &&
131+
${remotes_git_svn}..mybranch5 &&
132132
svn up "$SVN_TREE" &&
133133
test -x "$SVN_TREE"/exec.sh'
134134

@@ -140,7 +140,7 @@ test_expect_success "$name" '
140140
git update-index exec.sh &&
141141
git commit -m "$name" &&
142142
git-svn set-tree --find-copies-harder --rmdir \
143-
remotes/git-svn..mybranch5 &&
143+
${remotes_git_svn}..mybranch5 &&
144144
svn up "$SVN_TREE" &&
145145
test -L "$SVN_TREE"/exec.sh'
146146

@@ -152,7 +152,7 @@ test_expect_success "$name" '
152152
git update-index --add bar/zzz exec-2.sh &&
153153
git commit -m "$name" &&
154154
git-svn set-tree --find-copies-harder --rmdir \
155-
remotes/git-svn..mybranch5 &&
155+
${remotes_git_svn}..mybranch5 &&
156156
svn up "$SVN_TREE" &&
157157
test -x "$SVN_TREE"/bar/zzz &&
158158
test -L "$SVN_TREE"/exec-2.sh'
@@ -165,7 +165,7 @@ test_expect_success "$name" '
165165
git update-index exec-2.sh &&
166166
git commit -m "$name" &&
167167
git-svn set-tree --find-copies-harder --rmdir \
168-
remotes/git-svn..mybranch5 &&
168+
${remotes_git_svn}..mybranch5 &&
169169
svn up "$SVN_TREE" &&
170170
test -f "$SVN_TREE"/exec-2.sh &&
171171
test ! -L "$SVN_TREE"/exec-2.sh &&
@@ -191,7 +191,7 @@ GIT_SVN_ID=alt
191191
export GIT_SVN_ID
192192
test_expect_success "$name" \
193193
'git-svn init "$svnrepo" && git-svn fetch &&
194-
git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a &&
194+
git rev-list --pretty=raw ${remotes_git_svn} | grep ^tree | uniq > a &&
195195
git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b &&
196196
test_cmp a b'
197197

@@ -215,15 +215,15 @@ test_expect_success "$name" "test_cmp a expected"
215215

216216
test_expect_success 'exit if remote refs are ambigious' "
217217
git config --add svn-remote.svn.fetch \
218-
bar:refs/remotes/git-svn &&
218+
bar:refs/${remotes_git_svn} &&
219219
test_must_fail git-svn migrate
220220
"
221221

222222
test_expect_success 'exit if init-ing a would clobber a URL' '
223223
svnadmin create "${PWD}/svnrepo2" &&
224224
svn mkdir -m "mkdir bar" "${svnrepo}2/bar" &&
225225
git config --unset svn-remote.svn.fetch \
226-
"^bar:refs/remotes/git-svn$" &&
226+
"^bar:refs/${remotes_git_svn}$" &&
227227
test_must_fail git-svn init "${svnrepo}2/bar"
228228
'
229229

@@ -233,7 +233,7 @@ test_expect_success \
233233
git config --get svn-remote.svn.fetch \
234234
"^bar:refs/remotes/bar$" &&
235235
git config --get svn-remote.svn.fetch \
236-
"^:refs/remotes/git-svn$"
236+
"^:refs/${remotes_git_svn}$"
237237
'
238238

239239
test_expect_success 'able to dcommit to a subdirectory' "

t/t9101-git-svn-props.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ test_expect_success 'fetch revisions from svn' 'git-svn fetch'
7171

7272
name='test svn:keywords ignoring'
7373
test_expect_success "$name" \
74-
'git checkout -b mybranch remotes/git-svn &&
74+
'git checkout -b mybranch ${remotes_git_svn} &&
7575
echo Hi again >> kw.c &&
7676
git commit -a -m "test keywords ignoring" &&
77-
git-svn set-tree remotes/git-svn..mybranch &&
78-
git pull . remotes/git-svn'
77+
git-svn set-tree ${remotes_git_svn}..mybranch &&
78+
git pull . ${remotes_git_svn}'
7979

8080
expect='/* $Id$ */'
8181
got="`sed -ne 2p kw.c`"
@@ -91,7 +91,7 @@ test_expect_success "propset CR on crlf files" \
9191

9292
test_expect_success 'fetch and pull latest from svn and checkout a new wc' \
9393
'git-svn fetch &&
94-
git pull . remotes/git-svn &&
94+
git pull . ${remotes_git_svn} &&
9595
svn 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
@@ -113,7 +113,7 @@ cd test_wc
113113
svn commit -m "propset CRLF on cr files"'
114114
cd ..
115115
test_expect_success 'fetch and pull latest from svn' \
116-
'git-svn fetch && git pull . remotes/git-svn'
116+
'git-svn fetch && git pull . ${remotes_git_svn}'
117117

118118
b_cr="`git-hash-object cr`"
119119
b_ne_cr="`git-hash-object ne_cr`"
@@ -161,7 +161,7 @@ cat >create-ignore-index.expect <<\EOF
161161
EOF
162162

163163
test_expect_success 'test create-ignore' "
164-
git-svn fetch && git pull . remotes/git-svn &&
164+
git-svn fetch && git pull . ${remotes_git_svn} &&
165165
git-svn create-ignore &&
166166
cmp ./.gitignore create-ignore.expect &&
167167
cmp ./deeply/.gitignore create-ignore.expect &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test_expect_success 'initialize repo' '
1616
test_expect_success 'mirror via git-svn' '
1717
git-svn init "$svnrepo" &&
1818
git-svn fetch &&
19-
git checkout -f -b test-rmdir remotes/git-svn
19+
git checkout -f -b test-rmdir ${remotes_git_svn}
2020
'
2121

2222
test_expect_success 'Try a commit on rmdir' '

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test_expect_success 'commit complementing change from git' '
4242
test_expect_success 'dcommit fails to commit because of conflict' '
4343
git-svn init "$svnrepo" &&
4444
git-svn fetch &&
45-
git reset --hard refs/remotes/git-svn &&
45+
git reset --hard refs/${remotes_git_svn} &&
4646
svn co "$svnrepo" t.svn &&
4747
cd t.svn &&
4848
echo fourth line from svn >> file &&
@@ -56,7 +56,7 @@ test_expect_success 'dcommit fails to commit because of conflict' '
5656
'
5757

5858
test_expect_success 'dcommit does the svn equivalent of an index merge' "
59-
git reset --hard refs/remotes/git-svn &&
59+
git reset --hard refs/${remotes_git_svn} &&
6060
echo 'index merge' > file2 &&
6161
git update-index --add file2 &&
6262
git commit -a -m 'index merge' &&
@@ -77,7 +77,7 @@ test_expect_success 'commit another change from svn side' '
7777
'
7878

7979
test_expect_success 'multiple dcommit from git-svn will not clobber svn' "
80-
git reset --hard refs/remotes/git-svn &&
80+
git reset --hard refs/${remotes_git_svn} &&
8181
echo new file >> new-file &&
8282
git update-index --add new-file &&
8383
git commit -a -m 'new file' &&

t/t9107-git-svn-migrate.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ test_expect_success 'setup old-looking metadata' '
1919
mv "$GIT_DIR"/svn/* "$GIT_DIR"/ &&
2020
mv "$GIT_DIR"/svn/.metadata "$GIT_DIR"/ &&
2121
rmdir "$GIT_DIR"/svn &&
22-
git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn &&
23-
git update-ref refs/heads/svn-HEAD refs/remotes/git-svn &&
24-
git update-ref -d refs/remotes/git-svn refs/remotes/git-svn
22+
git update-ref refs/heads/git-svn-HEAD refs/${remotes_git_svn} &&
23+
git update-ref refs/heads/svn-HEAD refs/${remotes_git_svn} &&
24+
git update-ref -d refs/${remotes_git_svn} refs/${remotes_git_svn}
2525
'
2626

2727
head=`git rev-parse --verify refs/heads/git-svn-HEAD^0`
@@ -33,11 +33,11 @@ test_expect_success 'initialize old-style (v0) git-svn layout' '
3333
echo "$svnrepo" > "$GIT_DIR"/svn/info/url &&
3434
git-svn migrate &&
3535
! test -d "$GIT_DIR"/git-svn &&
36-
git rev-parse --verify refs/remotes/git-svn^0 &&
36+
git rev-parse --verify refs/${remotes_git_svn}^0 &&
3737
git rev-parse --verify refs/remotes/svn^0 &&
3838
test "$(git config --get svn-remote.svn.url)" = "$svnrepo" &&
3939
test `git config --get svn-remote.svn.fetch` = \
40-
":refs/remotes/git-svn"
40+
":refs/${remotes_git_svn}"
4141
'
4242

4343
test_expect_success 'initialize a multi-repository repo' '
@@ -94,7 +94,7 @@ test_expect_success 'migrate --minimize on old inited layout' '
9494
grep "^tags/0\.1:refs/remotes/tags/0\.1$" fetch.out &&
9595
grep "^tags/0\.2:refs/remotes/tags/0\.2$" fetch.out &&
9696
grep "^tags/0\.3:refs/remotes/tags/0\.3$" fetch.out
97-
grep "^:refs/remotes/git-svn" fetch.out
97+
grep "^:refs/${remotes_git_svn}" fetch.out
9898
'
9999

100100
test_expect_success ".rev_db auto-converted to .rev_map.UUID" '

t/t9110-git-svn-use-svm-props.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
2222
bar_url=http://mayonaise/svnrepo/bar
2323
test_expect_success 'verify metadata for /bar' "
2424
git cat-file commit refs/remotes/bar | \
25-
grep '^git-svn-id: $bar_url@12 $uuid$' &&
25+
grep '^${git_svn_id}: $bar_url@12 $uuid$' &&
2626
git cat-file commit refs/remotes/bar~1 | \
27-
grep '^git-svn-id: $bar_url@11 $uuid$' &&
27+
grep '^${git_svn_id}: $bar_url@11 $uuid$' &&
2828
git cat-file commit refs/remotes/bar~2 | \
29-
grep '^git-svn-id: $bar_url@10 $uuid$' &&
29+
grep '^${git_svn_id}: $bar_url@10 $uuid$' &&
3030
git cat-file commit refs/remotes/bar~3 | \
31-
grep '^git-svn-id: $bar_url@9 $uuid$' &&
31+
grep '^${git_svn_id}: $bar_url@9 $uuid$' &&
3232
git cat-file commit refs/remotes/bar~4 | \
33-
grep '^git-svn-id: $bar_url@6 $uuid$' &&
33+
grep '^${git_svn_id}: $bar_url@6 $uuid$' &&
3434
git cat-file commit refs/remotes/bar~5 | \
35-
grep '^git-svn-id: $bar_url@1 $uuid$'
35+
grep '^${git_svn_id}: $bar_url@1 $uuid$'
3636
"
3737

3838
e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
3939
test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
4040
git cat-file commit refs/remotes/e | \
41-
grep '^git-svn-id: $e_url@1 $uuid$'
41+
grep '^${git_svn_id}: $e_url@1 $uuid$'
4242
"
4343

4444
dir_url=http://mayonaise/svnrepo/dir
4545
test_expect_success 'verify metadata for /dir' "
4646
git cat-file commit refs/remotes/dir | \
47-
grep '^git-svn-id: $dir_url@2 $uuid$' &&
47+
grep '^${git_svn_id}: $dir_url@2 $uuid$' &&
4848
git cat-file commit refs/remotes/dir~1 | \
49-
grep '^git-svn-id: $dir_url@1 $uuid$'
49+
grep '^${git_svn_id}: $dir_url@1 $uuid$'
5050
"
5151

5252
test_expect_success 'find commit based on SVN revision number' "

t/t9111-git-svn-use-svnsync-props.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,31 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89
2121
bar_url=http://mayonaise/svnrepo/bar
2222
test_expect_success 'verify metadata for /bar' "
2323
git cat-file commit refs/remotes/bar | \
24-
grep '^git-svn-id: $bar_url@12 $uuid$' &&
24+
grep '^${git_svn_id}: $bar_url@12 $uuid$' &&
2525
git cat-file commit refs/remotes/bar~1 | \
26-
grep '^git-svn-id: $bar_url@11 $uuid$' &&
26+
grep '^${git_svn_id}: $bar_url@11 $uuid$' &&
2727
git cat-file commit refs/remotes/bar~2 | \
28-
grep '^git-svn-id: $bar_url@10 $uuid$' &&
28+
grep '^${git_svn_id}: $bar_url@10 $uuid$' &&
2929
git cat-file commit refs/remotes/bar~3 | \
30-
grep '^git-svn-id: $bar_url@9 $uuid$' &&
30+
grep '^${git_svn_id}: $bar_url@9 $uuid$' &&
3131
git cat-file commit refs/remotes/bar~4 | \
32-
grep '^git-svn-id: $bar_url@6 $uuid$' &&
32+
grep '^${git_svn_id}: $bar_url@6 $uuid$' &&
3333
git cat-file commit refs/remotes/bar~5 | \
34-
grep '^git-svn-id: $bar_url@1 $uuid$'
34+
grep '^${git_svn_id}: $bar_url@1 $uuid$'
3535
"
3636

3737
e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e
3838
test_expect_success 'verify metadata for /dir/a/b/c/d/e' "
3939
git cat-file commit refs/remotes/e | \
40-
grep '^git-svn-id: $e_url@1 $uuid$'
40+
grep '^${git_svn_id}: $e_url@1 $uuid$'
4141
"
4242

4343
dir_url=http://mayonaise/svnrepo/dir
4444
test_expect_success 'verify metadata for /dir' "
4545
git cat-file commit refs/remotes/dir | \
46-
grep '^git-svn-id: $dir_url@2 $uuid$' &&
46+
grep '^${git_svn_id}: $dir_url@2 $uuid$' &&
4747
git cat-file commit refs/remotes/dir~1 | \
48-
grep '^git-svn-id: $dir_url@1 $uuid$'
48+
grep '^${git_svn_id}: $dir_url@1 $uuid$'
4949
"
5050

5151
test_done

t/t9120-git-svn-clone-with-percent-escapes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ else
2121
test_expect_success 'test clone with percent escapes' '
2222
git svn clone "$svnrepo/pr%20ject" clone &&
2323
cd clone &&
24-
git rev-parse refs/remotes/git-svn &&
24+
git rev-parse refs/${remotes_git_svn} &&
2525
cd ..
2626
'
2727
fi

t/t9123-git-svn-rebuild-with-rewriteroot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ rm -rf import
1717
test_expect_success 'init, fetch and checkout repository' '
1818
git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" &&
1919
git svn fetch
20-
git checkout -b mybranch remotes/git-svn
20+
git checkout -b mybranch ${remotes_git_svn}
2121
'
2222

2323
test_expect_success 'remove rev_map' '

0 commit comments

Comments
 (0)