]>
Commit | Line | Data |
---|---|---|
41337e22 EW |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2007 Eric Wong | |
4 | # | |
5 | ||
1364ff27 | 6 | test_description='git svn init/clone tests' |
41337e22 EW |
7 | |
8 | . ./lib-git-svn.sh | |
9 | ||
f69e836f | 10 | test_expect_success 'setup svnrepo' ' |
41337e22 EW |
11 | mkdir project project/trunk project/branches project/tags && |
12 | echo foo > project/trunk/foo && | |
da083d68 | 13 | svn_cmd import -m "$test_description" project "$svnrepo"/project && |
41337e22 | 14 | rm -rf project |
f69e836f | 15 | ' |
41337e22 | 16 | |
f69e836f | 17 | test_expect_success 'basic clone' ' |
41337e22 | 18 | test ! -d trunk && |
f69e836f | 19 | git svn clone "$svnrepo"/project/trunk && |
41337e22 EW |
20 | test -d trunk/.git/svn && |
21 | test -e trunk/foo && | |
22 | rm -rf trunk | |
f69e836f | 23 | ' |
41337e22 | 24 | |
f69e836f | 25 | test_expect_success 'clone to target directory' ' |
41337e22 | 26 | test ! -d target && |
f69e836f | 27 | git svn clone "$svnrepo"/project/trunk target && |
41337e22 EW |
28 | test -d target/.git/svn && |
29 | test -e target/foo && | |
30 | rm -rf target | |
f69e836f | 31 | ' |
41337e22 | 32 | |
f69e836f | 33 | test_expect_success 'clone with --stdlayout' ' |
41337e22 | 34 | test ! -d project && |
f69e836f | 35 | git svn clone -s "$svnrepo"/project && |
41337e22 EW |
36 | test -d project/.git/svn && |
37 | test -e project/foo && | |
38 | rm -rf project | |
f69e836f | 39 | ' |
41337e22 | 40 | |
f69e836f | 41 | test_expect_success 'clone to target directory with --stdlayout' ' |
41337e22 | 42 | test ! -d target && |
f69e836f | 43 | git svn clone -s "$svnrepo"/project target && |
41337e22 EW |
44 | test -d target/.git/svn && |
45 | test -e target/foo && | |
46 | rm -rf target | |
f69e836f | 47 | ' |
41337e22 | 48 | |
f849bb6b JH |
49 | test_expect_success 'init without -s/-T/-b/-t does not warn' ' |
50 | test ! -d trunk && | |
51 | git svn init "$svnrepo"/project/trunk trunk 2>warning && | |
c7cf9566 | 52 | ! grep -q prefix warning && |
f849bb6b JH |
53 | rm -rf trunk && |
54 | rm -f warning | |
55 | ' | |
56 | ||
57 | test_expect_success 'clone without -s/-T/-b/-t does not warn' ' | |
58 | test ! -d trunk && | |
59 | git svn clone "$svnrepo"/project/trunk 2>warning && | |
c7cf9566 | 60 | ! grep -q prefix warning && |
f849bb6b JH |
61 | rm -rf trunk && |
62 | rm -f warning | |
63 | ' | |
64 | ||
65 | test_svn_configured_prefix () { | |
66 | prefix=$1 && | |
67 | cat >expect <<EOF && | |
68 | project/trunk:refs/remotes/${prefix}trunk | |
69 | project/branches/*:refs/remotes/${prefix}* | |
70 | project/tags/*:refs/remotes/${prefix}tags/* | |
71 | EOF | |
72 | test ! -f actual && | |
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 && | |
77 | rm -f expect actual | |
78 | } | |
79 | ||
fe191fca | 80 | test_expect_success 'init with -s/-T/-b/-t assumes --prefix=origin/' ' |
f849bb6b JH |
81 | test ! -d project && |
82 | git svn init -s "$svnrepo"/project project 2>warning && | |
c7cf9566 | 83 | ! grep -q prefix warning && |
fe191fca | 84 | test_svn_configured_prefix "origin/" && |
f849bb6b JH |
85 | rm -rf project && |
86 | rm -f warning | |
87 | ' | |
88 | ||
fe191fca | 89 | test_expect_success 'clone with -s/-T/-b/-t assumes --prefix=origin/' ' |
f849bb6b JH |
90 | test ! -d project && |
91 | git svn clone -s "$svnrepo"/project 2>warning && | |
c7cf9566 | 92 | ! grep -q prefix warning && |
fe191fca | 93 | test_svn_configured_prefix "origin/" && |
f849bb6b JH |
94 | rm -rf project && |
95 | rm -f warning | |
96 | ' | |
97 | ||
7bbc458b | 98 | test_expect_success 'init with -s/-T/-b/-t and --prefix "" still works' ' |
f849bb6b | 99 | test ! -d project && |
7bbc458b | 100 | git svn init -s "$svnrepo"/project project --prefix "" 2>warning && |
c7cf9566 | 101 | ! grep -q prefix warning && |
f849bb6b JH |
102 | test_svn_configured_prefix "" && |
103 | rm -rf project && | |
104 | rm -f warning | |
105 | ' | |
106 | ||
7bbc458b | 107 | test_expect_success 'clone with -s/-T/-b/-t and --prefix "" still works' ' |
f849bb6b | 108 | test ! -d project && |
7bbc458b | 109 | git svn clone -s "$svnrepo"/project --prefix "" 2>warning && |
c7cf9566 | 110 | ! grep -q prefix warning && |
f849bb6b JH |
111 | test_svn_configured_prefix "" && |
112 | rm -rf project && | |
113 | rm -f warning | |
114 | ' | |
115 | ||
b5571653 | 116 | test_expect_success 'init with -T as a full url works' ' |
4be4d550 AD |
117 | test ! -d project && |
118 | git svn init -T "$svnrepo"/project/trunk project && | |
119 | rm -rf project | |
120 | ' | |
121 | ||
41337e22 | 122 | test_done |