builtin/fetch.c: reorder function definitions
[git/mingw.git] / t / t9106-git-svn-commit-diff-clobber.sh
blobf6d7ac7c5f67871ce332716561ea6aba7a6f920f
1 #!/bin/sh
3 # Copyright (c) 2006 Eric Wong
4 test_description='git svn commit-diff clobber'
5 . ./lib-git-svn.sh
7 test_expect_success 'initialize repo' '
8 mkdir import &&
10 cd import &&
11 echo initial >file &&
12 svn_cmd import -m "initial" . "$svnrepo"
13 ) &&
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 &&
21 cd t.svn &&
22 echo second line from svn >>file &&
23 poke file &&
24 svn_cmd commit -m "second line from svn"
25 ) &&
26 rm -rf t.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" &&
46 git svn fetch &&
47 git reset --hard refs/${remotes_git_svn} &&
48 svn_cmd co "$svnrepo" t.svn &&
50 cd t.svn &&
51 echo fourth line from svn >>file &&
52 poke file &&
53 svn_cmd commit -m "fourth line from svn"
54 ) &&
55 rm -rf t.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' &&
69 git svn dcommit
72 test_expect_success 'commit another change from svn side' '
73 svn_cmd co "$svnrepo" t.svn &&
75 cd t.svn &&
76 echo third line from svn >>file &&
77 poke file &&
78 svn_cmd commit -m "third line from svn"
79 ) &&
80 rm -rf t.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 &&
102 git svn dcommit
105 test_done