t / t9128-git-svn-cmd-branch.shon commit Merge branch 'jk/sort-iter-test-output' (49541db)
   1#!/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        (
  12                (cd import &&
  13                mkdir trunk branches tags &&
  14                (cd trunk &&
  15                echo foo > foo
  16                ) &&
  17                svn_cmd import -m "import for git-svn" . "$svnrepo" >/dev/null
  18                ) &&
  19                rm -rf import &&
  20                svn_cmd co "$svnrepo"/trunk trunk &&
  21                (cd trunk &&
  22                echo bar >> foo &&
  23                svn_cmd ci -m "updated trunk"
  24                ) &&
  25                rm -rf trunk
  26        )
  27'
  28
  29test_expect_success 'import into git' '
  30        git svn init --stdlayout "$svnrepo" &&
  31        git svn fetch &&
  32        git checkout remotes/origin/trunk
  33'
  34
  35test_expect_success 'git svn branch tests' '
  36        git svn branch a &&
  37        base=$(git rev-parse HEAD:) &&
  38        test $base = $(git rev-parse remotes/origin/a:) &&
  39        git svn branch -m "created branch b blah" b &&
  40        test $base = $(git rev-parse remotes/origin/b:) &&
  41        test_must_fail git branch -m "no branchname" &&
  42        git svn branch -n c &&
  43        test_must_fail git rev-parse remotes/origin/c &&
  44        test_must_fail git svn branch a &&
  45        git svn branch -t tag1 &&
  46        test $base = $(git rev-parse remotes/origin/tags/tag1:) &&
  47        git svn branch --tag tag2 &&
  48        test $base = $(git rev-parse remotes/origin/tags/tag2:) &&
  49        git svn tag tag3 &&
  50        test $base = $(git rev-parse remotes/origin/tags/tag3:) &&
  51        git svn tag -m "created tag4 foo" tag4 &&
  52        test $base = $(git rev-parse remotes/origin/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/origin/tags/tag5 &&
  56        test_must_fail git svn tag tag1
  57'
  58
  59test_expect_success 'branch uses correct svn-remote' '
  60        (svn_cmd co "$svnrepo" svn &&
  61        cd svn &&
  62        mkdir mirror &&
  63        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" ) &&
  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
  76'
  77
  78test_done