t / t9106-git-svn-dcommit-clobber-series.shon commit Merge branch 'aw/mirror-push' into jk/send-pack (bcd2e26)
   1#!/bin/sh
   2#
   3# Copyright (c) 2007 Eric Wong
   4test_description='git-svn dcommit clobber series'
   5. ./lib-git-svn.sh
   6
   7test_expect_success 'initialize repo' "
   8        mkdir import &&
   9        cd import &&
  10        awk 'BEGIN { for (i = 1; i < 64; i++) { print i } }' > file
  11        svn import -m 'initial' . $svnrepo &&
  12        cd .. &&
  13        git svn init $svnrepo &&
  14        git svn fetch &&
  15        test -e file
  16        "
  17
  18test_expect_success '(supposedly) non-conflicting change from SVN' "
  19        test x\"\`sed -n -e 58p < file\`\" = x58 &&
  20        test x\"\`sed -n -e 61p < file\`\" = x61 &&
  21        svn co $svnrepo tmp &&
  22        cd tmp &&
  23                perl -i -p -e 's/^58\$/5588/' file &&
  24                perl -i -p -e 's/^61\$/6611/' file &&
  25                test x\"\`sed -n -e 58p < file\`\" = x5588 &&
  26                test x\"\`sed -n -e 61p < file\`\" = x6611 &&
  27                svn commit -m '58 => 5588, 61 => 6611' &&
  28                cd ..
  29        "
  30
  31test_expect_success 'some unrelated changes to git' "
  32        echo hi > life &&
  33        git update-index --add life &&
  34        git commit -m hi-life &&
  35        echo bye >> life &&
  36        git commit -m bye-life life
  37        "
  38
  39test_expect_success 'change file but in unrelated area' "
  40        test x\"\`sed -n -e 4p < file\`\" = x4 &&
  41        test x\"\`sed -n -e 7p < file\`\" = x7 &&
  42        perl -i -p -e 's/^4\$/4444/' file &&
  43        perl -i -p -e 's/^7\$/7777/' file &&
  44        test x\"\`sed -n -e 4p < file\`\" = x4444 &&
  45        test x\"\`sed -n -e 7p < file\`\" = x7777 &&
  46        git commit -m '4 => 4444, 7 => 7777' file &&
  47        git svn dcommit &&
  48        svn up tmp &&
  49        cd tmp &&
  50                test x\"\`sed -n -e 4p < file\`\" = x4444 &&
  51                test x\"\`sed -n -e 7p < file\`\" = x7777 &&
  52                test x\"\`sed -n -e 58p < file\`\" = x5588 &&
  53                test x\"\`sed -n -e 61p < file\`\" = x6611
  54        "
  55
  56test_expect_failure 'attempt to dcommit with a dirty index' '
  57        echo foo >>file &&
  58        git add file &&
  59        git svn dcommit
  60'
  61
  62test_done