blob: 0f4e7362714b548cf67339f2cc4711da4d1c3b6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#!/bin/sh
#
# Copyright (c) 2006 Eric Wong
#
test_description='git-svn --follow-parent fetching'
. ./lib-git-svn.sh
test_expect_success 'initialize repo' "
mkdir import &&
cd import &&
mkdir -p trunk &&
echo hello > trunk/readme &&
svn import -m 'initial' . $svnrepo &&
cd .. &&
svn co $svnrepo wc &&
cd wc &&
echo world >> trunk/readme &&
poke trunk/readme &&
svn commit -m 'another commit' &&
svn up &&
svn mv -m 'rename to thunk' trunk thunk &&
svn up &&
echo goodbye >> thunk/readme &&
poke thunk/readme &&
svn commit -m 'bye now' &&
cd ..
"
test_expect_success 'init and fetch --follow-parent a moved directory' "
git-svn init -i thunk $svnrepo/thunk &&
git-svn fetch --follow-parent -i thunk &&
test \"\`git-rev-parse --verify refs/remotes/thunk@2\`\" \
= \"\`git-rev-parse --verify refs/remotes/thunk~1\`\" &&
test \"\`git-cat-file blob refs/remotes/thunk:readme |\
sed -n -e '3p'\`\" = goodbye &&
test -n \"\`git-config --get svn-remote.git-svn.fetch \
'^trunk:refs/remotes/thunk@2$'\`\"
"
test_expect_success 'init and fetch from one svn-remote' "
git-repo-config svn-remote.git-svn.url $svnrepo &&
git-repo-config --add svn-remote.git-svn.fetch \
trunk:refs/remotes/svn/trunk &&
git-repo-config --add svn-remote.git-svn.fetch \
thunk:refs/remotes/svn/thunk &&
git-svn fetch --follow-parent -i svn/thunk &&
test \"\`git-rev-parse --verify refs/remotes/svn/trunk\`\" \
= \"\`git-rev-parse --verify refs/remotes/svn/thunk~1\`\" &&
test \"\`git-cat-file blob refs/remotes/svn/thunk:readme |\
sed -n -e '3p'\`\" = goodbye
"
test_expect_success 'follow deleted parent' "
svn cp -m 'resurrecting trunk as junk' \
-r2 $svnrepo/trunk $svnrepo/junk &&
git-repo-config --add svn-remote.git-svn.fetch \
junk:refs/remotes/svn/junk &&
git-svn fetch --follow-parent -i svn/thunk &&
git-svn fetch -i svn/junk --follow-parent &&
test -z \"\`git diff svn/junk svn/trunk\`\" &&
test \"\`git merge-base svn/junk svn/trunk\`\" \
= \"\`git rev-parse svn/trunk\`\"
"
test_expect_success 'follow larger parent' "
mkdir -p import/trunk/thunk/bump/thud &&
echo hi > import/trunk/thunk/bump/thud/file &&
svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
git-svn init -i larger $svnrepo/another-larger/trunk/thunk/bump/thud &&
git-svn fetch -i larger --follow-parent &&
git-rev-parse --verify refs/remotes/larger &&
git-rev-parse --verify \
refs/remotes/larger-parent/trunk/thunk/bump/thud &&
test \"\`git-merge-base \
refs/remotes/larger-parent/trunk/thunk/bump/thud \
refs/remotes/larger\`\" = \
\"\`git-rev-parse refs/remotes/larger\`\"
true
"
test_expect_success 'follow higher-level parent' "
svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
svn co $svnrepo/blob blob &&
cd blob &&
echo hi > hi &&
svn add hi &&
svn commit -m 'hihi' &&
cd ..
svn mkdir -m 'new glob at top level' $svnrepo/glob &&
svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
git-svn init -i blob $svnrepo/glob/blob &&
git-svn fetch -i blob --follow-parent
"
test_expect_success 'follow deleted directory' "
svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye&&
svn rm -m 'remove glob' $svnrepo/glob &&
git-svn init -i glob $svnrepo/glob &&
git-svn fetch -i glob &&
test \"\`git cat-file blob refs/remotes/glob~1:blob/bye\`\" = hi &&
test -z \"\`git ls-tree -z refs/remotes/glob\`\"
"
# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
# in trunk/subversion/bindings/swig/perl
test_expect_success '' "
mkdir -p import/trunk/subversion/bindings/swig/perl/t &&
for i in a b c ; do \
echo \$i > import/trunk/subversion/bindings/swig/perl/\$i.pm &&
echo _\$i > import/trunk/subversion/bindings/swig/perl/t/\$i.t; \
done &&
echo 'bad delete test' > \
import/trunk/subversion/bindings/swig/perl/t/larger-parent &&
echo 'bad delete test 2' > \
import/trunk/subversion/bindings/swig/perl/another-larger &&
cd import &&
svn import -m 'r9270 test' . $svnrepo/r9270 &&
cd .. &&
svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
cd r9270 &&
svn mkdir native &&
svn mv t native/t &&
for i in a b c; do svn mv \$i.pm native/\$i.pm; done &&
echo z >> native/t/c.t &&
svn commit -m 'reorg test' &&
cd .. &&
git-svn init -i r9270-t \
$svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
git-svn fetch -i r9270-t --follow-parent &&
test \`git rev-list r9270-t | wc -l\` -eq 2 &&
test \"\`git ls-tree --name-only r9270-t~1\`\" = \
\"\`git ls-tree --name-only r9270-t\`\"
"
test_debug 'gitk --all &'
test_done
|