Last minute fixes before -rc1
[alt-git.git] / t / t9128-git-svn-cmd-branch.sh
blob9871f5abc933b8f86b33f1efcbea5e1966b55eee
1 #!/bin/sh
3 # Copyright (c) 2008 Deskin Miller
6 test_description='git svn partial-rebuild tests'
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./lib-git-svn.sh
11 test_expect_success 'initialize svnrepo' '
12 mkdir import &&
14 (cd import &&
15 mkdir trunk branches tags &&
16 (cd trunk &&
17 echo foo > foo
18 ) &&
19 svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
20 ) &&
21 rm -rf import &&
22 svn_cmd co "$svnrepo"/trunk trunk &&
23 (cd trunk &&
24 echo bar >> foo &&
25 svn_cmd ci -m "updated trunk"
26 ) &&
27 rm -rf trunk
31 test_expect_success 'import into git' '
32 git svn init --stdlayout "$svnrepo" &&
33 git svn fetch &&
34 git checkout remotes/origin/trunk
37 test_expect_success 'git svn branch tests' '
38 git svn branch a &&
39 base=$(git rev-parse HEAD:) &&
40 test $base = $(git rev-parse remotes/origin/a:) &&
41 git svn branch -m "created branch b blah" b &&
42 test $base = $(git rev-parse remotes/origin/b:) &&
43 test_must_fail git branch -m "no branchname" &&
44 git svn branch -n c &&
45 test_must_fail git rev-parse remotes/origin/c &&
46 test_must_fail git svn branch a &&
47 git svn branch -t tag1 &&
48 test $base = $(git rev-parse remotes/origin/tags/tag1:) &&
49 git svn branch --tag tag2 &&
50 test $base = $(git rev-parse remotes/origin/tags/tag2:) &&
51 git svn tag tag3 &&
52 test $base = $(git rev-parse remotes/origin/tags/tag3:) &&
53 git svn tag -m "created tag4 foo" tag4 &&
54 test $base = $(git rev-parse remotes/origin/tags/tag4:) &&
55 test_must_fail git svn tag -m "no tagname" &&
56 git svn tag -n tag5 &&
57 test_must_fail git rev-parse remotes/origin/tags/tag5 &&
58 test_must_fail git svn tag tag1
61 test_expect_success 'branch uses correct svn-remote' '
62 (svn_cmd co "$svnrepo" svn &&
63 cd svn &&
64 mkdir mirror &&
65 svn_cmd add mirror &&
66 svn_cmd copy trunk mirror/ &&
67 svn_cmd copy tags mirror/ &&
68 svn_cmd copy branches mirror/ &&
69 svn_cmd ci -m "made mirror" ) &&
70 rm -rf svn &&
71 git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
72 git svn fetch -R mirror &&
73 git checkout mirror/trunk &&
74 base=$(git rev-parse HEAD:) &&
75 git svn branch -m "branch in mirror" d &&
76 test $base = $(git rev-parse remotes/mirror/d:) &&
77 test_must_fail git rev-parse remotes/d
80 test_done