]> git.ipfire.org Git - thirdparty/git.git/blob - t/t9106-git-svn-commit-diff-clobber.sh
t5563: prevent "ambiguous redirect"
[thirdparty/git.git] / t / t9106-git-svn-commit-diff-clobber.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Eric Wong
4 test_description='git svn commit-diff clobber'
5
6 TEST_FAILS_SANITIZE_LEAK=true
7 . ./lib-git-svn.sh
8
9 test_expect_success 'initialize repo' '
10 mkdir import &&
11 (
12 cd import &&
13 echo initial >file &&
14 svn_cmd import -m "initial" . "$svnrepo"
15 ) &&
16 echo initial > file &&
17 git update-index --add file &&
18 git commit -a -m "initial"
19 '
20 test_expect_success 'commit change from svn side' '
21 svn_cmd co "$svnrepo" t.svn &&
22 (
23 cd t.svn &&
24 echo second line from svn >>file &&
25 poke file &&
26 svn_cmd commit -m "second line from svn"
27 ) &&
28 rm -rf t.svn
29 '
30
31 test_expect_success 'commit conflicting change from git' '
32 echo second line from git >> file &&
33 git commit -a -m "second line from git" &&
34 test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo"
35 '
36
37 test_expect_success 'commit complementing change from git' '
38 git reset --hard HEAD~1 &&
39 echo second line from svn >> file &&
40 git commit -a -m "second line from svn" &&
41 echo third line from git >> file &&
42 git commit -a -m "third line from git" &&
43 git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo"
44 '
45
46 test_expect_success 'dcommit fails to commit because of conflict' '
47 git svn init "$svnrepo" &&
48 git svn fetch &&
49 git reset --hard refs/remotes/git-svn &&
50 svn_cmd co "$svnrepo" t.svn &&
51 (
52 cd t.svn &&
53 echo fourth line from svn >>file &&
54 poke file &&
55 svn_cmd commit -m "fourth line from svn"
56 ) &&
57 rm -rf t.svn &&
58 echo "fourth line from git" >> file &&
59 git commit -a -m "fourth line from git" &&
60 test_must_fail git svn dcommit
61 '
62
63 test_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
74 test_expect_success 'commit another change from svn side' '
75 svn_cmd co "$svnrepo" t.svn &&
76 (
77 cd t.svn &&
78 echo third line from svn >>file &&
79 poke file &&
80 svn_cmd commit -m "third line from svn"
81 ) &&
82 rm -rf t.svn
83 '
84
85 test_expect_success 'multiple dcommit from git svn will not clobber svn' "
86 git reset --hard refs/remotes/git-svn &&
87 echo new file >> new-file &&
88 git update-index --add new-file &&
89 git commit -a -m 'new file' &&
90 echo clobber > file &&
91 git commit -a -m 'clobber' &&
92 test_must_fail git svn dcommit
93 "
94
95
96 test_expect_success 'check that rebase really failed' '
97 git status >output &&
98 grep currently.rebasing output
99 '
100
101 test_expect_success 'resolve, continue the rebase and dcommit' "
102 echo clobber and I really mean it > file &&
103 git update-index file &&
104 git rebase --continue &&
105 git svn dcommit
106 "
107
108 test_done