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