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