tests: document format of conflicts from checkout -m
We are about to change the format of the conflict hunks that ‘checkout --merge’ writes. Add tests checking the current behavior first. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Mar 20, 2010 at 19:27 UTC
47349a8cc02b3cb39bfc69cb7abec88ad3e34ebf
1 file changed
+61
-4
t/t7201-co.sh
+61
-4
@@ -11,10 +11,12 @@ Test switching across them.
11
! [master] Initial A one, A two
12
* [renamer] Renamer R one->uno, M two
13
! [side] Side M one, D two, A three
14
- ---
15
- + [side] Side M one, D two, A three
16
- * [renamer] Renamer R one->uno, M two
17
- +*+ [master] Initial A one, A two
14
+ ! [simple] Simple D one, M two
15
+ ----
16
+ + [simple] Simple D one, M two
17
+ + [side] Side M one, D two, A three
18
+ * [renamer] Renamer R one->uno, M two
19
+ +*++ [master] Initial A one, A two
20
21
'
22
@@ -52,6 +54,11 @@ test_expect_success setup '
54
git update-index --add --remove one two three &&
55
git commit -m "Side M one, D two, A three" &&
56
57
+ git checkout -b simple master &&
58
+ rm -f one &&
59
+ fill a c e > two &&
60
+ git commit -a -m "Simple D one, M two" &&
61
+
62
git checkout master
63
'
64
@@ -166,6 +173,56 @@ test_expect_success 'checkout -m with merge conflict' '
173
! test -s current
174
'
175
176
+test_expect_success 'format of merge conflict from checkout -m' '
177
+
178
+ git checkout -f master && git clean -f &&
179
+
180
+ fill b d > two &&
181
+ git checkout -m simple &&
182
+
183
+ git ls-files >current &&
184
+ fill same two two two >expect &&
185
+ test_cmp current expect &&
186
+
187
+ cat <<-EOF >expect &&
188
+ <<<<<<< simple
189
+ a
190
+ c
191
+ e
192
+ =======
193
+ b
194
+ d
195
+ >>>>>>> local
196
+ EOF
197
+ test_cmp two expect
198
+'
199
+
200
+test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
201
+
202
+ git checkout -f master && git reset --hard && git clean -f &&
203
+
204
+ fill b d > two &&
205
+ git checkout --merge --conflict=diff3 simple &&
206
+
207
+ cat <<-EOF >expect &&
208
+ <<<<<<< simple
209
+ a
210
+ c
211
+ e
212
+ |||||||
213
+ a
214
+ b
215
+ c
216
+ d
217
+ e
218
+ =======
219
+ b
220
+ d
221
+ >>>>>>> local
222
+ EOF
223
+ test_cmp two expect
224
+'
225
+
226
test_expect_success 'checkout to detach HEAD (with advice declined)' '
227
228
git config advice.detachedHead false &&