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