t / t9103-git-svn-graft-branches.shon commit Make sure the empty tree exists when needed in merge-recursive. (9abd46a)
   1test_description='git-svn graft-branches'
   2. ./lib-git-svn.sh
   3
   4test_expect_success 'initialize repo' "
   5        mkdir import &&
   6        cd import &&
   7        mkdir -p trunk branches tags &&
   8        echo hello > trunk/readme &&
   9        svn import -m 'import for git-svn' . $svnrepo &&
  10        cd .. &&
  11        svn cp -m 'tag a' $svnrepo/trunk $svnrepo/tags/a &&
  12        svn cp -m 'branch a' $svnrepo/trunk $svnrepo/branches/a &&
  13        svn co $svnrepo wc &&
  14        cd wc &&
  15        echo feedme >> branches/a/readme &&
  16        svn commit -m hungry &&
  17        svn up &&
  18        cd trunk &&
  19        svn merge -r3:4 $svnrepo/branches/a &&
  20        svn commit -m 'merge with a' &&
  21        cd ../.. &&
  22        svn log -v $svnrepo &&
  23        git-svn init -i trunk $svnrepo/trunk &&
  24        git-svn init -i a $svnrepo/branches/a &&
  25        git-svn init -i tags/a $svnrepo/tags/a &&
  26        git-svn fetch -i tags/a &&
  27        git-svn fetch -i a &&
  28        git-svn fetch -i trunk
  29        "
  30
  31r1=`git-rev-list remotes/trunk | tail -n1`
  32r2=`git-rev-list remotes/tags/a | tail -n1`
  33r3=`git-rev-list remotes/a | tail -n1`
  34r4=`git-rev-list remotes/a | head -n1`
  35r5=`git-rev-list remotes/trunk | head -n1`
  36
  37test_expect_success 'test graft-branches regexes and copies' "
  38        test -n "$r1" &&
  39        test -n "$r2" &&
  40        test -n "$r3" &&
  41        test -n "$r4" &&
  42        test -n "$r5" &&
  43        git-svn graft-branches &&
  44        grep '^$r2 $r1' $GIT_DIR/info/grafts &&
  45        grep '^$r3 $r1' $GIT_DIR/info/grafts &&
  46        grep '^$r5 ' $GIT_DIR/info/grafts | grep '$r4' | grep '$r1'
  47        "
  48
  49test_debug 'gitk --all & sleep 1'
  50
  51test_expect_success 'test graft-branches with tree-joins' "
  52        rm $GIT_DIR/info/grafts &&
  53        git-svn graft-branches --no-default-regex --no-graft-copy -B &&
  54        grep '^$r3 ' $GIT_DIR/info/grafts | grep '$r1' | grep '$r2' &&
  55        grep '^$r2 $r1' $GIT_DIR/info/grafts &&
  56        grep '^$r5 ' $GIT_DIR/info/grafts | grep '$r1' | grep '$r4'
  57        "
  58
  59# the result of this is kinda funky, we have a strange history and
  60# this is just a test :)
  61test_debug 'gitk --all &'
  62
  63test_done