t / t9106-git-svn-commit-diff-clobber.shon commit Merge branch 'maint' of git://repo.or.cz/git-gui into maint (53a5824)
   1#!/bin/sh
   2#
   3# Copyright (c) 2006 Eric Wong
   4test_description='git-svn commit-diff clobber'
   5. ./lib-git-svn.sh
   6
   7test_expect_success 'initialize repo' "
   8        mkdir import &&
   9        cd import &&
  10        echo initial > file &&
  11        svn import -m 'initial' . $svnrepo &&
  12        cd .. &&
  13        echo initial > file &&
  14        git update-index --add file &&
  15        git commit -a -m 'initial'
  16        "
  17test_expect_success 'commit change from svn side' "
  18        svn co $svnrepo t.svn &&
  19        cd t.svn &&
  20        echo second line from svn >> file &&
  21        poke file &&
  22        svn commit -m 'second line from svn' &&
  23        cd .. &&
  24        rm -rf t.svn
  25        "
  26
  27test_expect_failure 'commit conflicting change from git' "
  28        echo second line from git >> file &&
  29        git commit -a -m 'second line from git' &&
  30        git-svn commit-diff -r1 HEAD~1 HEAD $svnrepo
  31        " || true
  32
  33test_expect_success 'commit complementing change from git' "
  34        git reset --hard HEAD~1 &&
  35        echo second line from svn >> file &&
  36        git commit -a -m 'second line from svn' &&
  37        echo third line from git >> file &&
  38        git commit -a -m 'third line from git' &&
  39        git-svn commit-diff -r2 HEAD~1 HEAD $svnrepo
  40        "
  41
  42test_expect_failure 'dcommit fails to commit because of conflict' "
  43        git-svn init $svnrepo &&
  44        git-svn fetch &&
  45        git reset --hard refs/remotes/git-svn &&
  46        svn co $svnrepo t.svn &&
  47        cd t.svn &&
  48        echo fourth line from svn >> file &&
  49        poke file &&
  50        svn commit -m 'fourth line from svn' &&
  51        cd .. &&
  52        rm -rf t.svn &&
  53        echo 'fourth line from git' >> file &&
  54        git commit -a -m 'fourth line from git' &&
  55        git-svn dcommit
  56        " || true
  57
  58test_expect_success 'dcommit does the svn equivalent of an index merge' "
  59        git reset --hard refs/remotes/git-svn &&
  60        echo 'index merge' > file2 &&
  61        git update-index --add file2 &&
  62        git commit -a -m 'index merge' &&
  63        echo 'more changes' >> file2 &&
  64        git update-index file2 &&
  65        git commit -a -m 'more changes' &&
  66        git-svn dcommit
  67        "
  68
  69test_done