3 # Copyright (c) 2006 Eric Wong
4 test_description
='git svn commit-diff clobber'
7 test_expect_success
'initialize repo' '
12 svn_cmd import -m "initial" . "$svnrepo"
14 echo initial > file &&
15 git update-index --add file &&
16 git commit -a -m "initial"
18 test_expect_success
'commit change from svn side' '
19 svn_cmd co "$svnrepo" t.svn &&
22 echo second line from svn >>file &&
24 svn_cmd commit -m "second line from svn"
29 test_expect_success
'commit conflicting change from git' '
30 echo second line from git >> file &&
31 git commit -a -m "second line from git" &&
32 test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
35 test_expect_success
'commit complementing change from git' '
36 git reset --hard HEAD~1 &&
37 echo second line from svn >> file &&
38 git commit -a -m "second line from svn" &&
39 echo third line from git >> file &&
40 git commit -a -m "third line from git" &&
41 git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo"
44 test_expect_success
'dcommit fails to commit because of conflict' '
45 git svn init "$svnrepo" &&
47 git reset --hard refs/${remotes_git_svn} &&
48 svn_cmd co "$svnrepo" t.svn &&
51 echo fourth line from svn >>file &&
53 svn_cmd commit -m "fourth line from svn"
56 echo "fourth line from git" >> file &&
57 git commit -a -m "fourth line from git" &&
58 test_must_fail git svn dcommit
61 test_expect_success
'dcommit does the svn equivalent of an index merge' "
62 git reset --hard refs/${remotes_git_svn} &&
63 echo 'index merge' > file2 &&
64 git update-index --add file2 &&
65 git commit -a -m 'index merge' &&
66 echo 'more changes' >> file2 &&
67 git update-index file2 &&
68 git commit -a -m 'more changes' &&
72 test_expect_success
'commit another change from svn side' '
73 svn_cmd co "$svnrepo" t.svn &&
76 echo third line from svn >>file &&
78 svn_cmd commit -m "third line from svn"
83 test_expect_success
'multiple dcommit from git svn will not clobber svn' "
84 git reset --hard refs/${remotes_git_svn} &&
85 echo new file >> new-file &&
86 git update-index --add new-file &&
87 git commit -a -m 'new file' &&
88 echo clobber > file &&
89 git commit -a -m 'clobber' &&
90 test_must_fail git svn dcommit
94 test_expect_success
'check that rebase really failed' '
95 test -d .git/rebase-apply
98 test_expect_success
'resolve, continue the rebase and dcommit' "
99 echo clobber and I really mean it > file &&
100 git update-index file &&
101 git rebase --continue &&