blob: 4e95f791db1ff2be9781cf965d5a12a86c5a8ce3 [file] [log] [blame]
Florian Ragwitz5de70ef2008-10-04 19:35:17 -07001#!/bin/sh
2#
3# Copyright (c) 2008 Deskin Miller
4#
5
6test_description='git svn partial-rebuild tests'
7. ./lib-git-svn.sh
8
9test_expect_success 'initialize svnrepo' '
10 mkdir import &&
11 (
Jens Lehmannfd4ec4f2010-09-06 20:39:54 +020012 (cd import &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070013 mkdir trunk branches tags &&
Jens Lehmannfd4ec4f2010-09-06 20:39:54 +020014 (cd trunk &&
15 echo foo > foo
16 ) &&
17 svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
18 ) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070019 rm -rf import &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040020 svn_cmd co "$svnrepo"/trunk trunk &&
Jens Lehmannfd4ec4f2010-09-06 20:39:54 +020021 (cd trunk &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070022 echo bar >> foo &&
Jens Lehmannfd4ec4f2010-09-06 20:39:54 +020023 svn_cmd ci -m "updated trunk"
24 ) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070025 rm -rf trunk
26 )
27'
28
29test_expect_success 'import into git' '
30 git svn init --stdlayout "$svnrepo" &&
31 git svn fetch &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020032 git checkout remotes/origin/trunk
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070033'
34
35test_expect_success 'git svn branch tests' '
36 git svn branch a &&
37 base=$(git rev-parse HEAD:) &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020038 test $base = $(git rev-parse remotes/origin/a:) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070039 git svn branch -m "created branch b blah" b &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020040 test $base = $(git rev-parse remotes/origin/b:) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070041 test_must_fail git branch -m "no branchname" &&
42 git svn branch -n c &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020043 test_must_fail git rev-parse remotes/origin/c &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070044 test_must_fail git svn branch a &&
45 git svn branch -t tag1 &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020046 test $base = $(git rev-parse remotes/origin/tags/tag1:) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070047 git svn branch --tag tag2 &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020048 test $base = $(git rev-parse remotes/origin/tags/tag2:) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070049 git svn tag tag3 &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020050 test $base = $(git rev-parse remotes/origin/tags/tag3:) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070051 git svn tag -m "created tag4 foo" tag4 &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020052 test $base = $(git rev-parse remotes/origin/tags/tag4:) &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070053 test_must_fail git svn tag -m "no tagname" &&
54 git svn tag -n tag5 &&
Johan Herlandfe191fc2013-10-11 14:57:07 +020055 test_must_fail git rev-parse remotes/origin/tags/tag5 &&
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070056 test_must_fail git svn tag tag1
57'
58
Deskin Millera0fbc872008-12-01 21:43:00 -050059test_expect_success 'branch uses correct svn-remote' '
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040060 (svn_cmd co "$svnrepo" svn &&
Deskin Millera0fbc872008-12-01 21:43:00 -050061 cd svn &&
62 mkdir mirror &&
Eygene Ryabinkinda083d62009-05-08 12:06:16 +040063 svn_cmd add mirror &&
64 svn_cmd copy trunk mirror/ &&
65 svn_cmd copy tags mirror/ &&
66 svn_cmd copy branches mirror/ &&
67 svn_cmd ci -m "made mirror" ) &&
Deskin Millera0fbc872008-12-01 21:43:00 -050068 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
76'
77
Florian Ragwitz5de70ef2008-10-04 19:35:17 -070078test_done