3 # Copyright (c) 2006 Eric Wong
6 test_description
='git-svn --follow-parent fetching'
9 test_expect_success
'initialize repo' "
13 echo hello > trunk/readme &&
14 svn import -m 'initial' . $svnrepo &&
18 echo world >> trunk/readme &&
20 svn commit -m 'another commit' &&
22 svn mv -m 'rename to thunk' trunk thunk &&
24 echo goodbye >> thunk/readme &&
26 svn commit -m 'bye now' &&
30 test_expect_success
'init and fetch --follow-parent a moved directory' "
31 git-svn init -i thunk $svnrepo/thunk &&
32 git-svn fetch --follow-parent -i thunk &&
33 test \"\`git-rev-parse --verify refs/remotes/trunk\`\" \
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
39 test_expect_success
'init and fetch from one svn-remote' "
40 git-repo-config svn-remote.git-svn.url $svnrepo &&
41 git-repo-config --add svn-remote.git-svn.fetch \
42 trunk:refs/remotes/svn/trunk &&
43 git-repo-config --add svn-remote.git-svn.fetch \
44 thunk:refs/remotes/svn/thunk &&
45 git-svn fetch --follow-parent -i svn/thunk &&
46 test \"\`git-rev-parse --verify refs/remotes/svn/trunk\`\" \
47 = \"\`git-rev-parse --verify refs/remotes/svn/thunk~1\`\" &&
48 test \"\`git-cat-file blob refs/remotes/svn/thunk:readme |\
49 sed -n -e '3p'\`\" = goodbye
52 test_expect_success
'follow deleted parent' "
53 svn cp -m 'resurrecting trunk as junk' \
54 -r2 $svnrepo/trunk $svnrepo/junk &&
55 git-repo-config --add svn-remote.git-svn.fetch \
56 junk:refs/remotes/svn/junk &&
57 git-svn fetch --follow-parent -i svn/thunk &&
58 git-svn fetch -i svn/junk --follow-parent &&
59 test -z \"\`git diff svn/junk svn/trunk\`\" &&
60 test \"\`git merge-base svn/junk svn/trunk\`\" \
61 = \"\`git rev-parse svn/trunk\`\"
64 test_expect_success
'follow larger parent' "
65 mkdir -p import/trunk/thunk/bump/thud &&
66 echo hi > import/trunk/thunk/bump/thud/file &&
67 svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
68 svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
69 git-svn init -i larger $svnrepo/another-larger/trunk/thunk/bump/thud &&
70 git-svn fetch -i larger --follow-parent &&
71 git-rev-parse --verify refs/remotes/larger &&
72 git-rev-parse --verify \
73 refs/remotes/larger-parent/trunk/thunk/bump/thud &&
74 test \"\`git-merge-base \
75 refs/remotes/larger-parent/trunk/thunk/bump/thud \
76 refs/remotes/larger\`\" = \
77 \"\`git-rev-parse refs/remotes/larger\`\"
81 test_expect_success
'follow higher-level parent' "
82 svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
83 svn co $svnrepo/blob blob &&
87 svn commit -m 'hihi' &&
89 svn mkdir -m 'new glob at top level' $svnrepo/glob &&
90 svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
91 git-svn init -i blob $svnrepo/glob/blob &&
92 git-svn fetch -i blob --follow-parent
95 test_expect_success
'follow deleted directory' "
96 svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye&&
97 svn rm -m 'remove glob' $svnrepo/glob &&
98 git-svn init -i glob $svnrepo/glob &&
99 git-svn fetch -i glob &&
100 test \"\`git cat-file blob refs/remotes/glob~1:blob/bye\`\" = hi &&
101 test -z \"\`git ls-tree -z refs/remotes/glob\`\"
104 test_debug
'gitk --all &'