t / t9128-git-svn-cmd-branch.shon commit Merge branch 'maint' (a9645b7)
   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                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
  26        )
  27'
  28
  29test_expect_success 'import into git' '
  30        git svn init --stdlayout "$svnrepo" &&
  31        git svn fetch &&
  32        git checkout remotes/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/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
  57'
  58
  59test_done