3 # Copyright (c) 2007 Eric Wong
6 test_description='git svn init/clone tests'
10 # setup, run inside tmp so we don't have any conflicts with $svnrepo
16 test_expect_success 'setup svnrepo' '
17 mkdir project project/trunk project/branches project/tags &&
18 echo foo > project/trunk/foo &&
19 svn_cmd import -m "$test_description" project "$svnrepo"/project &&
23 test_expect_success 'basic clone' '
25 git svn clone "$svnrepo"/project/trunk &&
26 test -d trunk/.git/svn &&
31 test_expect_success 'clone to target directory' '
33 git svn clone "$svnrepo"/project/trunk target &&
34 test -d target/.git/svn &&
39 test_expect_success 'clone with --stdlayout' '
41 git svn clone -s "$svnrepo"/project &&
42 test -d project/.git/svn &&
43 test -e project/foo &&
47 test_expect_success 'clone to target directory with --stdlayout' '
49 git svn clone -s "$svnrepo"/project target &&
50 test -d target/.git/svn &&
55 test_expect_success 'init without -s/-T/-b/-t does not warn' '
57 git svn init "$svnrepo"/project/trunk trunk 2>warning &&
58 test_must_fail grep -q prefix warning &&
63 test_expect_success 'clone without -s/-T/-b/-t does not warn' '
65 git svn clone "$svnrepo"/project/trunk 2>warning &&
66 test_must_fail grep -q prefix warning &&
71 test_svn_configured_prefix () {
74 project/trunk:refs/remotes/${prefix}trunk
75 project/branches/*:refs/remotes/${prefix}*
76 project/tags/*:refs/remotes/${prefix}tags/*
79 git --git-dir=project/.git config svn-remote.svn.fetch >>actual &&
80 git --git-dir=project/.git config svn-remote.svn.branches >>actual &&
81 git --git-dir=project/.git config svn-remote.svn.tags >>actual &&
82 test_cmp expect actual &&
86 test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' '
88 git svn init -s "$svnrepo"/project project 2>warning &&
89 test_must_fail grep -q prefix warning &&
90 test_svn_configured_prefix "origin/" &&
95 test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' '
97 git svn clone -s "$svnrepo"/project 2>warning &&
98 test_must_fail grep -q prefix warning &&
99 test_svn_configured_prefix "origin/" &&
104 test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' '
106 git svn init -s "$svnrepo"/project project --prefix "" 2>warning &&
107 test_must_fail grep -q prefix warning &&
108 test_svn_configured_prefix "" &&
113 test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' '
115 git svn clone -s "$svnrepo"/project --prefix "" 2>warning &&
116 test_must_fail grep -q prefix warning &&
117 test_svn_configured_prefix "" &&
122 test_expect_success 'init with -T as a full url works' '
124 git svn init -T "$svnrepo"/project/trunk project &&