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