t / t9161-git-svn-mergeinfo-push.shon commit Git/Packet.pm: extract parts of t0021/rot13-filter.pl for reuse (0fe8d51)
   1#!/bin/sh
   2#
   3# Portions copyright (c) 2007, 2009 Sam Vilain
   4# Portions copyright (c) 2011 Bryan Jacobs
   5#
   6
   7test_description='git-svn svn mergeinfo propagation'
   8
   9. ./lib-git-svn.sh
  10
  11test_expect_success 'load svn dump' "
  12        svnadmin load -q '$rawsvnrepo' \
  13          < '$TEST_DIRECTORY/t9161/branches.dump' &&
  14        git svn init --minimize-url -R svnmerge \
  15          -T trunk -b branches '$svnrepo' &&
  16        git svn fetch --all
  17        "
  18
  19test_expect_success 'propagate merge information' '
  20        git config svn.pushmergeinfo yes &&
  21        git checkout origin/svnb1 &&
  22        git merge --no-ff origin/svnb2 &&
  23        git svn dcommit
  24        '
  25
  26test_expect_success 'check svn:mergeinfo' '
  27        mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
  28        test "$mergeinfo" = "/branches/svnb2:3,8"
  29        '
  30
  31test_expect_success 'merge another branch' '
  32        git merge --no-ff origin/svnb3 &&
  33        git svn dcommit
  34        '
  35
  36test_expect_success 'check primary parent mergeinfo respected' '
  37        mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
  38        test "$mergeinfo" = "/branches/svnb2:3,8
  39/branches/svnb3:4,9"
  40        '
  41
  42test_expect_success 'merge existing merge' '
  43        git merge --no-ff origin/svnb4 &&
  44        git svn dcommit
  45        '
  46
  47test_expect_success "check both parents' mergeinfo respected" '
  48        mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
  49        test "$mergeinfo" = "/branches/svnb2:3,8
  50/branches/svnb3:4,9
  51/branches/svnb4:5-6,10-12
  52/branches/svnb5:6,11"
  53        '
  54
  55test_expect_success 'make further commits to branch' '
  56        git checkout origin/svnb2 &&
  57        touch newb2file &&
  58        git add newb2file &&
  59        git commit -m "later b2 commit" &&
  60        touch newb2file-2 &&
  61        git add newb2file-2 &&
  62        git commit -m "later b2 commit 2" &&
  63        git svn dcommit
  64        '
  65
  66test_expect_success 'second forward merge' '
  67        git checkout origin/svnb1 &&
  68        git merge --no-ff origin/svnb2 &&
  69        git svn dcommit
  70        '
  71
  72test_expect_success 'check new mergeinfo added' '
  73        mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
  74        test "$mergeinfo" = "/branches/svnb2:3,8,16-17
  75/branches/svnb3:4,9
  76/branches/svnb4:5-6,10-12
  77/branches/svnb5:6,11"
  78        '
  79
  80test_expect_success 'reintegration merge' '
  81        git checkout origin/svnb4 &&
  82        git merge --no-ff origin/svnb1 &&
  83        git svn dcommit
  84        '
  85
  86test_expect_success 'check reintegration mergeinfo' '
  87        mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4) &&
  88        test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
  89/branches/svnb2:3,8,16-17
  90/branches/svnb3:4,9
  91/branches/svnb5:6,11"
  92        '
  93
  94test_expect_success 'dcommit a merge at the top of a stack' '
  95        git checkout origin/svnb1 &&
  96        touch anotherfile &&
  97        git add anotherfile &&
  98        git commit -m "a commit" &&
  99        git merge origin/svnb4 &&
 100        git svn dcommit
 101        '
 102
 103test_done