pull: don't warn if pull.ff has been set
[git/debian.git] / t / t6047-diff3-conflict-markers.sh
blobf4655bb358ff7fa5c10427d49423fa5eb6849ab8
1 #!/bin/sh
3 test_description='recursive merge diff3 style conflict markers'
5 . ./test-lib.sh
7 # Setup:
8 # L1
9 # \
10 # ?
11 # /
12 # R1
14 # Where:
15 # L1 and R1 both have a file named 'content' but have no common history
18 test_expect_success 'setup no merge base' '
19 test_create_repo no_merge_base &&
21 cd no_merge_base &&
23 git checkout -b L &&
24 test_commit A content A &&
26 git checkout --orphan R &&
27 test_commit B content B
31 test_expect_success 'check no merge base' '
33 cd no_merge_base &&
35 git checkout L^0 &&
37 test_must_fail git -c merge.conflictstyle=diff3 merge --allow-unrelated-histories -s recursive R^0 &&
39 grep "|||||| empty tree" content
43 # Setup:
44 # L1
45 # / \
46 # master ?
47 # \ /
48 # R1
50 # Where:
51 # L1 and R1 have modified the same file ('content') in conflicting ways
54 test_expect_success 'setup unique merge base' '
55 test_create_repo unique_merge_base &&
57 cd unique_merge_base &&
59 test_commit base content "1
64 " &&
66 git branch L &&
67 git branch R &&
69 git checkout L &&
70 test_commit L content "1
75 7" &&
77 git checkout R &&
78 git rm content &&
79 test_commit R renamed "1
84 six"
88 test_expect_success 'check unique merge base' '
90 cd unique_merge_base &&
92 git checkout L^0 &&
93 MASTER=$(git rev-parse --short master) &&
95 test_must_fail git -c merge.conflictstyle=diff3 merge -s recursive R^0 &&
97 grep "|||||| $MASTER:content" renamed
101 # Setup:
102 # L1---L2--L3
103 # / \ / \
104 # master X1 ?
105 # \ / \ /
106 # R1---R2--R3
108 # Where:
109 # commits L1 and R1 have modified the same file in non-conflicting ways
110 # X1 is an auto-generated merge-base used when merging L1 and R1
111 # commits L2 and R2 are merges of R1 and L1 into L1 and R1, respectively
112 # commits L3 and R3 both modify 'content' in conflicting ways
115 test_expect_success 'setup multiple merge bases' '
116 test_create_repo multiple_merge_bases &&
118 cd multiple_merge_bases &&
120 test_commit initial content "1
124 5" &&
126 git branch L &&
127 git branch R &&
129 # Create L1
130 git checkout L &&
131 test_commit L1 content "0
136 5" &&
138 # Create R1
139 git checkout R &&
140 test_commit R1 content "1
145 6" &&
147 # Create L2
148 git checkout L &&
149 git merge R1 &&
151 # Create R2
152 git checkout R &&
153 git merge L1 &&
155 # Create L3
156 git checkout L &&
157 test_commit L3 content "0
163 A" &&
165 # Create R3
166 git checkout R &&
167 git rm content &&
168 test_commit R3 renamed "0
173 six"
177 test_expect_success 'check multiple merge bases' '
179 cd multiple_merge_bases &&
181 git checkout L^0 &&
183 test_must_fail git -c merge.conflictstyle=diff3 merge -s recursive R^0 &&
185 grep "|||||| merged common ancestors:content" renamed
189 test_expect_success 'rebase --merge describes parent of commit being picked' '
190 test_create_repo rebase &&
192 cd rebase &&
193 test_commit base file &&
194 test_commit master file &&
195 git checkout -b side HEAD^ &&
196 test_commit side file &&
197 test_must_fail git -c merge.conflictstyle=diff3 rebase --merge master &&
198 grep "||||||| parent of" file
202 test_expect_success 'rebase --apply describes fake ancestor base' '
204 cd rebase &&
205 git rebase --abort &&
206 test_must_fail git -c merge.conflictstyle=diff3 rebase --apply master &&
207 grep "||||||| constructed merge base" file
211 test_done