Merge branch 'ds/scalar-updates' into maint-2.42
[alt-git.git] / t / t9106-git-svn-commit-diff-clobber.sh
blobbca496c40e0a22011465083d6b36aa32e48e86b5
1 #!/bin/sh
3 # Copyright (c) 2006 Eric Wong
4 test_description='git svn commit-diff clobber'
6 . ./lib-git-svn.sh
8 test_expect_success 'initialize repo' '
9 mkdir import &&
11 cd import &&
12 echo initial >file &&
13 svn_cmd import -m "initial" . "$svnrepo"
14 ) &&
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 &&
22 cd t.svn &&
23 echo second line from svn >>file &&
24 poke file &&
25 svn_cmd commit -m "second line from svn"
26 ) &&
27 rm -rf t.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" &&
47 git svn fetch &&
48 git reset --hard refs/remotes/git-svn &&
49 svn_cmd co "$svnrepo" t.svn &&
51 cd t.svn &&
52 echo fourth line from svn >>file &&
53 poke file &&
54 svn_cmd commit -m "fourth line from svn"
55 ) &&
56 rm -rf t.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' &&
70 git svn dcommit
73 test_expect_success 'commit another change from svn side' '
74 svn_cmd co "$svnrepo" t.svn &&
76 cd t.svn &&
77 echo third line from svn >>file &&
78 poke file &&
79 svn_cmd commit -m "third line from svn"
80 ) &&
81 rm -rf t.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' '
96 git status >output &&
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 &&
104 git svn dcommit
107 test_done