mergetool: Fix typo in options passed to kdiff3
[git/mergetool.git] / t / t9104-git-svn-follow-parent.sh
blobd8f9cab35dcff89469f1974dcc7130e3d38f471e
1 #!/bin/sh
3 # Copyright (c) 2006 Eric Wong
6 test_description='git-svn fetching'
7 . ./lib-git-svn.sh
9 test_expect_success 'initialize repo' "
10 mkdir import &&
11 cd import &&
12 mkdir -p trunk &&
13 echo hello > trunk/readme &&
14 svn import -m 'initial' . $svnrepo &&
15 cd .. &&
16 svn co $svnrepo wc &&
17 cd wc &&
18 echo world >> trunk/readme &&
19 poke trunk/readme &&
20 svn commit -m 'another commit' &&
21 svn up &&
22 svn mv -m 'rename to thunk' trunk thunk &&
23 svn up &&
24 echo goodbye >> thunk/readme &&
25 poke thunk/readme &&
26 svn commit -m 'bye now' &&
27 cd ..
30 test_expect_success 'init and fetch a moved directory' "
31 git-svn init --minimize-url -i thunk $svnrepo/thunk &&
32 git-svn fetch -i thunk &&
33 test \"\`git rev-parse --verify refs/remotes/thunk@2\`\" \
34 = \"\`git rev-parse --verify refs/remotes/thunk~1\`\" &&
35 test \"\`git cat-file blob refs/remotes/thunk:readme |\
36 sed -n -e '3p'\`\" = goodbye &&
37 test -z \"\`git config --get svn-remote.svn.fetch \
38 '^trunk:refs/remotes/thunk@2$'\`\"
41 test_expect_success 'init and fetch from one svn-remote' "
42 git config svn-remote.svn.url $svnrepo &&
43 git config --add svn-remote.svn.fetch \
44 trunk:refs/remotes/svn/trunk &&
45 git config --add svn-remote.svn.fetch \
46 thunk:refs/remotes/svn/thunk &&
47 git-svn fetch -i svn/thunk &&
48 test \"\`git rev-parse --verify refs/remotes/svn/trunk\`\" \
49 = \"\`git rev-parse --verify refs/remotes/svn/thunk~1\`\" &&
50 test \"\`git cat-file blob refs/remotes/svn/thunk:readme |\
51 sed -n -e '3p'\`\" = goodbye
54 test_expect_success 'follow deleted parent' "
55 svn cp -m 'resurrecting trunk as junk' \
56 -r2 $svnrepo/trunk $svnrepo/junk &&
57 git config --add svn-remote.svn.fetch \
58 junk:refs/remotes/svn/junk &&
59 git-svn fetch -i svn/thunk &&
60 git-svn fetch -i svn/junk &&
61 test -z \"\`git diff svn/junk svn/trunk\`\" &&
62 test \"\`git merge-base svn/junk svn/trunk\`\" \
63 = \"\`git rev-parse svn/trunk\`\"
66 test_expect_success 'follow larger parent' "
67 mkdir -p import/trunk/thunk/bump/thud &&
68 echo hi > import/trunk/thunk/bump/thud/file &&
69 svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
70 svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
71 git-svn init --minimize-url -i larger \
72 $svnrepo/another-larger/trunk/thunk/bump/thud &&
73 git-svn fetch -i larger &&
74 git rev-parse --verify refs/remotes/larger &&
75 git rev-parse --verify \
76 refs/remotes/larger-parent/trunk/thunk/bump/thud &&
77 test \"\`git merge-base \
78 refs/remotes/larger-parent/trunk/thunk/bump/thud \
79 refs/remotes/larger\`\" = \
80 \"\`git rev-parse refs/remotes/larger\`\"
81 true
84 test_expect_success 'follow higher-level parent' "
85 svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
86 svn co $svnrepo/blob blob &&
87 cd blob &&
88 echo hi > hi &&
89 svn add hi &&
90 svn commit -m 'hihi' &&
91 cd ..
92 svn mkdir -m 'new glob at top level' $svnrepo/glob &&
93 svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
94 git-svn init --minimize-url -i blob $svnrepo/glob/blob &&
95 git-svn fetch -i blob
98 test_expect_success 'follow deleted directory' "
99 svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye &&
100 svn rm -m 'remove glob' $svnrepo/glob &&
101 git-svn init --minimize-url -i glob $svnrepo/glob &&
102 git-svn fetch -i glob &&
103 test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi &&
104 test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1
107 # ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
108 # in trunk/subversion/bindings/swig/perl
109 test_expect_success 'follow-parent avoids deleting relevant info' "
110 mkdir -p import/trunk/subversion/bindings/swig/perl/t &&
111 for i in a b c ; do \
112 echo \$i > import/trunk/subversion/bindings/swig/perl/\$i.pm &&
113 echo _\$i > import/trunk/subversion/bindings/swig/perl/t/\$i.t; \
114 done &&
115 echo 'bad delete test' > \
116 import/trunk/subversion/bindings/swig/perl/t/larger-parent &&
117 echo 'bad delete test 2' > \
118 import/trunk/subversion/bindings/swig/perl/another-larger &&
119 cd import &&
120 svn import -m 'r9270 test' . $svnrepo/r9270 &&
121 cd .. &&
122 svn co $svnrepo/r9270/trunk/subversion/bindings/swig/perl r9270 &&
123 cd r9270 &&
124 svn mkdir native &&
125 svn mv t native/t &&
126 for i in a b c; do svn mv \$i.pm native/\$i.pm; done &&
127 echo z >> native/t/c.t &&
128 poke native/t/c.t &&
129 svn commit -m 'reorg test' &&
130 cd .. &&
131 git-svn init --minimize-url -i r9270-t \
132 $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t &&
133 git-svn fetch -i r9270-t &&
134 test \`git rev-list r9270-t | wc -l\` -eq 2 &&
135 test \"\`git ls-tree --name-only r9270-t~1\`\" = \
136 \"\`git ls-tree --name-only r9270-t\`\"
139 test_expect_success "track initial change if it was only made to parent" "
140 svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
141 git-svn init --minimize-url -i r9270-d \
142 $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
143 git-svn fetch -i r9270-d &&
144 test \`git rev-list r9270-d | wc -l\` -eq 3 &&
145 test \"\`git ls-tree --name-only r9270-t\`\" = \
146 \"\`git ls-tree --name-only r9270-d\`\" &&
147 test \"\`git rev-parse r9270-t\`\" = \
148 \"\`git rev-parse r9270-d~1\`\"
151 test_expect_success "track multi-parent paths" "
152 svn cp -m 'resurrect /glob' $svnrepo/r9270 $svnrepo/glob &&
153 git-svn multi-fetch &&
154 test \`git cat-file commit refs/remotes/glob | \
155 grep '^parent ' | wc -l\` -eq 2
158 test_expect_success "multi-fetch continues to work" "
159 git-svn multi-fetch
162 test_expect_success "multi-fetch works off a 'clean' repository" "
163 rm -r $GIT_DIR/svn $GIT_DIR/refs/remotes $GIT_DIR/logs &&
164 mkdir $GIT_DIR/svn &&
165 git-svn multi-fetch
168 test_debug 'gitk --all &'
170 test_done