test: trivial cleanups
[gitweb.git] / t / t9128-git-svn-cmd-branch.sh
index 47c4d4d938eea2ae193d8e4795a08d19a4900354..4b034a67f305622f146e66914139e58045e2457e 100755 (executable)
@@ -9,19 +9,19 @@ test_description='git svn partial-rebuild tests'
 test_expect_success 'initialize svnrepo' '
        mkdir import &&
        (
-               cd import &&
+               (cd import &&
                mkdir trunk branches tags &&
-               cd trunk &&
-               echo foo > foo &&
-               cd .. &&
-               svn import -m "import for git-svn" . "$svnrepo" >/dev/null &&
-               cd .. &&
+               (cd trunk &&
+               echo foo > foo
+               ) &&
+               svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
+               ) &&
                rm -rf import &&
-               svn co "$svnrepo"/trunk trunk &&
-               cd trunk &&
+               svn_cmd co "$svnrepo"/trunk trunk &&
+               (cd trunk &&
                echo bar >> foo &&
-               svn ci -m "updated trunk" &&
-               cd .. &&
+               svn_cmd ci -m "updated trunk"
+               ) &&
                rm -rf trunk
        )
 '
@@ -56,4 +56,23 @@ test_expect_success 'git svn branch tests' '
        test_must_fail git svn tag tag1
 '
 
+test_expect_success 'branch uses correct svn-remote' '
+       (svn_cmd co "$svnrepo" svn &&
+       cd svn &&
+       mkdir mirror &&
+       svn_cmd add mirror &&
+       svn_cmd copy trunk mirror/ &&
+       svn_cmd copy tags mirror/ &&
+       svn_cmd copy branches mirror/ &&
+       svn_cmd ci -m "made mirror" ) &&
+       rm -rf svn &&
+       git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
+       git svn fetch -R mirror &&
+       git checkout mirror/trunk &&
+       base=$(git rev-parse HEAD:) &&
+       git svn branch -m "branch in mirror" d &&
+       test $base = $(git rev-parse remotes/mirror/d:) &&
+       test_must_fail git rev-parse remotes/d
+'
+
 test_done