]>
Commit | Line | Data |
---|---|---|
45bf473a EW |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2006 Eric Wong | |
1364ff27 | 4 | test_description='git svn commit-diff clobber' |
45bf473a EW |
5 | . ./lib-git-svn.sh |
6 | ||
f69e836f | 7 | test_expect_success 'initialize repo' ' |
45bf473a | 8 | mkdir import && |
18a82692 JN |
9 | ( |
10 | cd import && | |
11 | echo initial >file && | |
12 | svn_cmd import -m "initial" . "$svnrepo" | |
fd4ec4f2 | 13 | ) && |
45bf473a EW |
14 | echo initial > file && |
15 | git update-index --add file && | |
f69e836f BD |
16 | git commit -a -m "initial" |
17 | ' | |
18 | test_expect_success 'commit change from svn side' ' | |
da083d68 | 19 | svn_cmd co "$svnrepo" t.svn && |
18a82692 JN |
20 | ( |
21 | cd t.svn && | |
22 | echo second line from svn >>file && | |
23 | poke file && | |
24 | svn_cmd commit -m "second line from svn" | |
fd4ec4f2 | 25 | ) && |
45bf473a | 26 | rm -rf t.svn |
f69e836f | 27 | ' |
45bf473a | 28 | |
f69e836f | 29 | test_expect_success 'commit conflicting change from git' ' |
45bf473a | 30 | echo second line from git >> file && |
f69e836f | 31 | git commit -a -m "second line from git" && |
1364ff27 | 32 | test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo" |
f69e836f | 33 | ' |
45bf473a | 34 | |
f69e836f | 35 | test_expect_success 'commit complementing change from git' ' |
45bf473a EW |
36 | git reset --hard HEAD~1 && |
37 | echo second line from svn >> file && | |
f69e836f | 38 | git commit -a -m "second line from svn" && |
45bf473a | 39 | echo third line from git >> file && |
f69e836f | 40 | git commit -a -m "third line from git" && |
1364ff27 | 41 | git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo" |
f69e836f | 42 | ' |
45bf473a | 43 | |
f69e836f | 44 | test_expect_success 'dcommit fails to commit because of conflict' ' |
1364ff27 NS |
45 | git svn init "$svnrepo" && |
46 | git svn fetch && | |
e1c0c158 | 47 | git reset --hard refs/remotes/git-svn && |
da083d68 | 48 | svn_cmd co "$svnrepo" t.svn && |
18a82692 JN |
49 | ( |
50 | cd t.svn && | |
51 | echo fourth line from svn >>file && | |
52 | poke file && | |
53 | svn_cmd commit -m "fourth line from svn" | |
fd4ec4f2 | 54 | ) && |
45bf473a | 55 | rm -rf t.svn && |
f69e836f BD |
56 | echo "fourth line from git" >> file && |
57 | git commit -a -m "fourth line from git" && | |
1364ff27 | 58 | test_must_fail git svn dcommit |
f69e836f | 59 | ' |
45bf473a EW |
60 | |
61 | test_expect_success 'dcommit does the svn equivalent of an index merge' " | |
e1c0c158 | 62 | git reset --hard refs/remotes/git-svn && |
45bf473a EW |
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' && | |
1364ff27 | 69 | git svn dcommit |
45bf473a EW |
70 | " |
71 | ||
f69e836f | 72 | test_expect_success 'commit another change from svn side' ' |
da083d68 | 73 | svn_cmd co "$svnrepo" t.svn && |
18a82692 JN |
74 | ( |
75 | cd t.svn && | |
76 | echo third line from svn >>file && | |
751eb395 | 77 | poke file && |
fd4ec4f2 JL |
78 | svn_cmd commit -m "third line from svn" |
79 | ) && | |
751eb395 | 80 | rm -rf t.svn |
f69e836f | 81 | ' |
751eb395 | 82 | |
1364ff27 | 83 | test_expect_success 'multiple dcommit from git svn will not clobber svn' " |
e1c0c158 | 84 | git reset --hard refs/remotes/git-svn && |
751eb395 EW |
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' && | |
d492b31c | 90 | test_must_fail git svn dcommit |
41ac414e | 91 | " |
751eb395 EW |
92 | |
93 | ||
51ef1daa | 94 | test_expect_success 'check that rebase really failed' ' |
2ac0d627 EN |
95 | git status >output && |
96 | grep currently.rebasing output | |
51ef1daa | 97 | ' |
751eb395 EW |
98 | |
99 | test_expect_success 'resolve, continue the rebase and dcommit' " | |
100 | echo clobber and I really mean it > file && | |
101 | git update-index file && | |
102 | git rebase --continue && | |
103 | git svn dcommit | |
104 | " | |
105 | ||
45bf473a | 106 | test_done |