3 # Copyright (c) 2007 Eric Wong
6 test_description
='git svn init/clone tests'
10 test_expect_success
'setup svnrepo' '
11 mkdir project project/trunk project/branches project/tags &&
12 echo foo > project/trunk/foo &&
13 svn_cmd import -m "$test_description" project "$svnrepo"/project &&
17 test_expect_success
'basic clone' '
19 git svn clone "$svnrepo"/project/trunk &&
20 test_path_is_dir trunk/.git/svn &&
21 test_path_exists trunk/foo &&
25 test_expect_success
'clone to target directory' '
27 git svn clone "$svnrepo"/project/trunk target &&
28 test_path_is_dir target/.git/svn &&
29 test_path_exists target/foo &&
33 test_expect_success
'clone with --stdlayout' '
35 git svn clone -s "$svnrepo"/project &&
36 test_path_is_dir project/.git/svn &&
37 test_path_exists project/foo &&
41 test_expect_success
'clone to target directory with --stdlayout' '
43 git svn clone -s "$svnrepo"/project target &&
44 test_path_is_dir target/.git/svn &&
45 test_path_exists target/foo &&
49 test_expect_success
'init without -s/-T/-b/-t does not warn' '
51 git svn init "$svnrepo"/project/trunk trunk 2>warning &&
52 ! grep -q prefix warning &&
57 test_expect_success
'clone without -s/-T/-b/-t does not warn' '
59 git svn clone "$svnrepo"/project/trunk 2>warning &&
60 ! grep -q prefix warning &&
65 test_svn_configured_prefix
() {
68 project/trunk:refs/remotes/${prefix}trunk
69 project/branches/*:refs/remotes/${prefix}*
70 project/tags/*:refs/remotes/${prefix}tags/*
73 git
--git-dir=project
/.git config svn-remote.svn.fetch
>>actual
&&
74 git
--git-dir=project
/.git config svn-remote.svn.branches
>>actual
&&
75 git
--git-dir=project
/.git config svn-remote.svn.tags
>>actual
&&
76 test_cmp expect actual
&&
80 test_expect_success
'init with -s/-T/-b/-t assumes --prefix=origin/' '
82 git svn init -s "$svnrepo"/project project 2>warning &&
83 ! grep -q prefix warning &&
84 test_svn_configured_prefix "origin/" &&
89 test_expect_success
'clone with -s/-T/-b/-t assumes --prefix=origin/' '
91 git svn clone -s "$svnrepo"/project 2>warning &&
92 ! grep -q prefix warning &&
93 test_svn_configured_prefix "origin/" &&
98 test_expect_success
'init with -s/-T/-b/-t and --prefix "" still works' '
100 git svn init -s "$svnrepo"/project project --prefix "" 2>warning &&
101 ! grep -q prefix warning &&
102 test_svn_configured_prefix "" &&
107 test_expect_success
'clone with -s/-T/-b/-t and --prefix "" still works' '
109 git svn clone -s "$svnrepo"/project --prefix "" 2>warning &&
110 ! grep -q prefix warning &&
111 test_svn_configured_prefix "" &&
116 test_expect_success
'init with -T as a full url works' '
118 git svn init -T "$svnrepo"/project/trunk project &&