3 # Copyright (c) 2006 Junio C Hamano
6 test_description='git rebase --merge test'
11 jumps over the lazy dog."
12 for i in 1 2 3 4 5 6 7 8 9 10
17 test_expect_success setup '
19 git commit -m"initial" &&
21 echo "11 $T" >>original &&
22 git commit -a -m"master updates a bit." &&
24 echo "12 $T" >>original &&
25 git commit -a -m"master updates a bit more." &&
28 (echo "0 $T" ; cat original) >renamed &&
30 git update-index --force-remove original &&
31 git commit -a -m"side renames and edits." &&
33 tr "[a-z]" "[A-Z]" <original >newfile &&
35 git commit -a -m"side edits further." &&
36 git branch second-side &&
38 tr "[a-m]" "[A-M]" <original >newfile &&
40 git commit -a -m"side edits once again." &&
42 git branch test-rebase side &&
43 git branch test-rebase-pick side &&
44 git branch test-reference-pick side &&
45 git branch test-conflicts side &&
46 git checkout -b test-merge side
49 test_expect_success 'reference merge' '
50 git merge -s recursive -m "reference merge" master
53 PRE_REBASE=$(git rev-parse test-rebase)
54 test_expect_success rebase '
55 git checkout test-rebase &&
56 GIT_TRACE=1 git rebase --merge master
59 test_expect_success 'test-rebase@{1} is pre rebase' '
60 test $PRE_REBASE = $(git rev-parse test-rebase@{1})
63 test_expect_success 'merge and rebase should match' '
64 git diff-tree -r test-rebase test-merge >difference &&
74 test_expect_success 'rebase the other way' '
75 git reset --hard master &&
76 git rebase --merge side
79 test_expect_success 'rebase -Xtheirs' '
80 git checkout -b conflicting master~2 &&
81 echo "AB $T" >> original &&
82 git commit -mconflicting original &&
83 git rebase -Xtheirs master &&
88 test_expect_success 'rebase -Xtheirs from orphan' '
89 git checkout --orphan orphan-conflicting master~2 &&
90 echo "AB $T" >> original &&
91 git commit -morphan-conflicting original &&
92 git rebase -Xtheirs master &&
97 test_expect_success 'merge and rebase should match' '
98 git diff-tree -r test-rebase test-merge >difference &&
108 test_expect_success 'picking rebase' '
109 git reset --hard side &&
110 git rebase --merge --onto master side^^ &&
111 mb=$(git merge-base master HEAD) &&
112 if test "$mb" = "$(git rev-parse master)"
119 f=$(git diff-tree --name-only HEAD^ HEAD) &&
120 g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
131 test_expect_success 'rebase -s funny -Xopt' '
132 test_when_finished "rm -fr test-bin funny.was.run" &&
134 cat >test-bin/git-merge-funny <<-EOF &&
136 case "\$1" in --opt) ;; *) exit 2 ;; esac
139 exec git merge-recursive "\$@"
141 chmod +x test-bin/git-merge-funny &&
143 git checkout -b test-funny master^ &&
146 PATH=./test-bin:$PATH
147 git rebase -s funny -Xopt master
149 test -f funny.was.run
152 test_expect_success 'rebase --skip works with two conflicts in a row' '
153 git checkout second-side &&
154 tr "[A-Z]" "[a-z]" <newfile >tmp &&
156 git commit -a -m"edit conflicting with side" &&
157 tr "[d-f]" "[D-F]" <newfile >tmp &&
159 git commit -a -m"another edit conflicting with side" &&
160 test_must_fail git rebase --merge test-conflicts &&
161 test_must_fail git rebase --skip &&