]>
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 EW |
8 | mkdir import && |
9 | cd import && | |
10 | echo initial > file && | |
da083d68 | 11 | svn_cmd import -m "initial" . "$svnrepo" && |
45bf473a EW |
12 | cd .. && |
13 | echo initial > file && | |
14 | git update-index --add file && | |
f69e836f BD |
15 | git commit -a -m "initial" |
16 | ' | |
17 | test_expect_success 'commit change from svn side' ' | |
da083d68 | 18 | svn_cmd co "$svnrepo" t.svn && |
45bf473a EW |
19 | cd t.svn && |
20 | echo second line from svn >> file && | |
7b3fab87 | 21 | poke file && |
da083d68 | 22 | svn_cmd commit -m "second line from svn" && |
45bf473a EW |
23 | cd .. && |
24 | rm -rf t.svn | |
f69e836f | 25 | ' |
45bf473a | 26 | |
f69e836f | 27 | test_expect_success 'commit conflicting change from git' ' |
45bf473a | 28 | echo second line from git >> file && |
f69e836f | 29 | git commit -a -m "second line from git" && |
1364ff27 | 30 | test_must_fail git svn commit-diff -r1 HEAD~1 HEAD "$svnrepo" |
f69e836f | 31 | ' |
45bf473a | 32 | |
f69e836f | 33 | test_expect_success 'commit complementing change from git' ' |
45bf473a EW |
34 | git reset --hard HEAD~1 && |
35 | echo second line from svn >> file && | |
f69e836f | 36 | git commit -a -m "second line from svn" && |
45bf473a | 37 | echo third line from git >> file && |
f69e836f | 38 | git commit -a -m "third line from git" && |
1364ff27 | 39 | git svn commit-diff -r2 HEAD~1 HEAD "$svnrepo" |
f69e836f | 40 | ' |
45bf473a | 41 | |
f69e836f | 42 | test_expect_success 'dcommit fails to commit because of conflict' ' |
1364ff27 NS |
43 | git svn init "$svnrepo" && |
44 | git svn fetch && | |
16805d3e | 45 | git reset --hard refs/${remotes_git_svn} && |
da083d68 | 46 | svn_cmd co "$svnrepo" t.svn && |
45bf473a EW |
47 | cd t.svn && |
48 | echo fourth line from svn >> file && | |
7b3fab87 | 49 | poke file && |
da083d68 | 50 | svn_cmd commit -m "fourth line from svn" && |
45bf473a EW |
51 | cd .. && |
52 | rm -rf t.svn && | |
f69e836f BD |
53 | echo "fourth line from git" >> file && |
54 | git commit -a -m "fourth line from git" && | |
1364ff27 | 55 | test_must_fail git svn dcommit |
f69e836f | 56 | ' |
45bf473a EW |
57 | |
58 | test_expect_success 'dcommit does the svn equivalent of an index merge' " | |
16805d3e | 59 | git reset --hard refs/${remotes_git_svn} && |
45bf473a EW |
60 | echo 'index merge' > file2 && |
61 | git update-index --add file2 && | |
62 | git commit -a -m 'index merge' && | |
63 | echo 'more changes' >> file2 && | |
64 | git update-index file2 && | |
65 | git commit -a -m 'more changes' && | |
1364ff27 | 66 | git svn dcommit |
45bf473a EW |
67 | " |
68 | ||
f69e836f | 69 | test_expect_success 'commit another change from svn side' ' |
da083d68 | 70 | svn_cmd co "$svnrepo" t.svn && |
751eb395 EW |
71 | cd t.svn && |
72 | echo third line from svn >> file && | |
73 | poke file && | |
da083d68 | 74 | svn_cmd commit -m "third line from svn" && |
751eb395 EW |
75 | cd .. && |
76 | rm -rf t.svn | |
f69e836f | 77 | ' |
751eb395 | 78 | |
1364ff27 | 79 | test_expect_success 'multiple dcommit from git svn will not clobber svn' " |
16805d3e | 80 | git reset --hard refs/${remotes_git_svn} && |
751eb395 EW |
81 | echo new file >> new-file && |
82 | git update-index --add new-file && | |
83 | git commit -a -m 'new file' && | |
84 | echo clobber > file && | |
85 | git commit -a -m 'clobber' && | |
d492b31c | 86 | test_must_fail git svn dcommit |
41ac414e | 87 | " |
751eb395 EW |
88 | |
89 | ||
51ef1daa JS |
90 | test_expect_success 'check that rebase really failed' ' |
91 | test -d .git/rebase-apply | |
92 | ' | |
751eb395 EW |
93 | |
94 | test_expect_success 'resolve, continue the rebase and dcommit' " | |
95 | echo clobber and I really mean it > file && | |
96 | git update-index file && | |
97 | git rebase --continue && | |
98 | git svn dcommit | |
99 | " | |
100 | ||
45bf473a | 101 | test_done |