402b614c76ffc53c4e2904b85fee94719519e7d1
   1#!/bin/sh
   2#
   3# Copyright (c) 2006 Eric Wong
   4#
   5
   6test_description='git-svn --follow-parent fetching'
   7. ./lib-git-svn.sh
   8
   9test_expect_success 'initialize repo' "
  10        mkdir import &&
  11        cd import &&
  12        mkdir -p trunk &&
  13        echo hello > trunk/readme &&
  14        svn import -m 'initial' . $svnrepo &&
  15        cd .. &&
  16        svn co $svnrepo wc &&
  17        cd wc &&
  18        echo world >> trunk/readme &&
  19        poke trunk/readme &&
  20        svn commit -m 'another commit' &&
  21        svn up &&
  22        svn mv -m 'rename to thunk' trunk thunk &&
  23        svn up &&
  24        echo goodbye >> thunk/readme &&
  25        poke thunk/readme &&
  26        svn commit -m 'bye now' &&
  27        cd ..
  28        "
  29
  30test_expect_success 'init and fetch --follow-parent a moved directory' "
  31        git-svn init -i thunk $svnrepo/thunk &&
  32        git-svn fetch --follow-parent -i thunk &&
  33        test \"\`git-rev-parse --verify refs/remotes/trunk\`\" \
  34           = \"\`git-rev-parse --verify refs/remotes/thunk~1\`\" &&
  35        test \"\`git-cat-file blob refs/remotes/thunk:readme |\
  36                 sed -n -e '3p'\`\" = goodbye
  37        "
  38
  39test_expect_success 'init and fetch from one svn-remote' "
  40        git-repo-config svn-remote.git-svn.url $svnrepo &&
  41        git-repo-config --add svn-remote.git-svn.fetch \
  42          trunk:refs/remotes/svn/trunk &&
  43        git-repo-config --add svn-remote.git-svn.fetch \
  44          thunk:refs/remotes/svn/thunk &&
  45        git-svn fetch --follow-parent -i svn/thunk &&
  46        test \"\`git-rev-parse --verify refs/remotes/svn/trunk\`\" \
  47           = \"\`git-rev-parse --verify refs/remotes/svn/thunk~1\`\" &&
  48        test \"\`git-cat-file blob refs/remotes/svn/thunk:readme |\
  49                 sed -n -e '3p'\`\" = goodbye
  50        "
  51
  52test_expect_success 'follow deleted parent' "
  53        svn cp -m 'resurrecting trunk as junk' \
  54               -r2 $svnrepo/trunk $svnrepo/junk &&
  55        git-repo-config --add svn-remote.git-svn.fetch \
  56          junk:refs/remotes/svn/junk &&
  57        git-svn fetch --follow-parent -i svn/thunk &&
  58        git-svn fetch -i svn/junk --follow-parent &&
  59        test -z \"\`git diff svn/junk svn/trunk\`\" &&
  60        test \"\`git merge-base svn/junk svn/trunk\`\" \
  61           = \"\`git rev-parse svn/trunk\`\"
  62        "
  63
  64test_debug 'gitk --all &'
  65
  66test_done