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