3 # Copyright (c) 2006 Eric Wong
4 test_description
='git svn commit-diff clobber'
8 test_expect_success
'initialize repo' '
13 svn_cmd import -m "initial" . "$svnrepo"
15 echo initial > file &&
16 git update-index --add file &&
17 git commit -a -m "initial"
19 test_expect_success
'commit change from svn side' '
20 svn_cmd co "$svnrepo" t.svn &&
23 echo second line from svn >>file &&
25 svn_cmd commit -m "second line from svn"
30 test_expect_success
'commit conflicting change from git' '
31 echo second line from git >> file &&
32 git commit -a -m "second line from git" &&
33 test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
36 test_expect_success
'commit complementing change from git' '
37 git reset --hard HEAD~1 &&
38 echo second line from svn >> file &&
39 git commit -a -m "second line from svn" &&
40 echo third line from git >> file &&
41 git commit -a -m "third line from git" &&
42 git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo"
45 test_expect_success
'dcommit fails to commit because of conflict' '
46 git svn init "$svnrepo" &&
48 git reset --hard refs/remotes/git-svn &&
49 svn_cmd co "$svnrepo" t.svn &&
52 echo fourth line from svn >>file &&
54 svn_cmd commit -m "fourth line from svn"
57 echo "fourth line from git" >> file &&
58 git commit -a -m "fourth line from git" &&
59 test_must_fail git svn dcommit
62 test_expect_success
'dcommit does the svn equivalent of an index merge' "
63 git reset --hard refs/remotes/git-svn &&
64 echo 'index merge' > file2 &&
65 git update-index --add file2 &&
66 git commit -a -m 'index merge' &&
67 echo 'more changes' >> file2 &&
68 git update-index file2 &&
69 git commit -a -m 'more changes' &&
73 test_expect_success
'commit another change from svn side' '
74 svn_cmd co "$svnrepo" t.svn &&
77 echo third line from svn >>file &&
79 svn_cmd commit -m "third line from svn"
84 test_expect_success
'multiple dcommit from git svn will not clobber svn' "
85 git reset --hard refs/remotes/git-svn &&
86 echo new file >> new-file &&
87 git update-index --add new-file &&
88 git commit -a -m 'new file' &&
89 echo clobber > file &&
90 git commit -a -m 'clobber' &&
91 test_must_fail git svn dcommit
95 test_expect_success
'check that rebase really failed' '
97 grep currently.rebasing output
100 test_expect_success
'resolve, continue the rebase and dcommit' "
101 echo clobber and I really mean it > file &&
102 git update-index file &&
103 git rebase --continue &&