test: remove httpd tests that ask for user
[git] / t / t7600-merge.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2007 Lars Hjemli
4 #
5
6 test_description='git merge
7
8 Testing basic merge operations/option parsing.
9
10 ! [c0] commit 0
11  ! [c1] commit 1
12   ! [c2] commit 2
13    ! [c3] commit 3
14     ! [c4] c4
15      ! [c5] c5
16       ! [c6] c6
17        * [master] Merge commit 'c1'
18 --------
19        - [master] Merge commit 'c1'
20  +     * [c1] commit 1
21       +  [c6] c6
22      +   [c5] c5
23     ++   [c4] c4
24    ++++  [c3] commit 3
25   +      [c2] commit 2
26 +++++++* [c0] commit 0
27 '
28
29 . ./test-lib.sh
30 . "$TEST_DIRECTORY"/lib-gpg.sh
31
32 printf '%s\n' 1 2 3 4 5 6 7 8 9 >file
33 printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >file.1
34 printf '%s\n' 1 2 3 4 '5 X' 6 7 8 9 >file.5
35 printf '%s\n' 1 2 3 4 5 6 7 8 '9 X' >file.9
36 printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >result.1
37 printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
38 printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
39 >empty
40
41 create_merge_msgs () {
42         echo "Merge tag 'c2'" >msg.1-5 &&
43         echo "Merge tags 'c2' and 'c3'" >msg.1-5-9 &&
44         {
45                 echo "Squashed commit of the following:" &&
46                 echo &&
47                 git log --no-merges ^HEAD c1
48         } >squash.1 &&
49         {
50                 echo "Squashed commit of the following:" &&
51                 echo &&
52                 git log --no-merges ^HEAD c2
53         } >squash.1-5 &&
54         {
55                 echo "Squashed commit of the following:" &&
56                 echo &&
57                 git log --no-merges ^HEAD c2 c3
58         } >squash.1-5-9 &&
59         : >msg.nologff &&
60         : >msg.nolognoff &&
61         {
62                 echo "* tag 'c3':" &&
63                 echo "  commit 3"
64         } >msg.log
65 }
66
67 verify_merge () {
68         test_cmp "$2" "$1" &&
69         git update-index --refresh &&
70         git diff --exit-code &&
71         if test -n "$3"
72         then
73                 git show -s --pretty=tformat:%s HEAD >msg.act &&
74                 test_cmp "$3" msg.act
75         fi
76 }
77
78 verify_head () {
79         echo "$1" >head.expected &&
80         git rev-parse HEAD >head.actual &&
81         test_cmp head.expected head.actual
82 }
83
84 verify_parents () {
85         printf '%s\n' "$@" >parents.expected &&
86         >parents.actual &&
87         i=1 &&
88         while test $i -le $#
89         do
90                 git rev-parse HEAD^$i >>parents.actual &&
91                 i=$(expr $i + 1) ||
92                 return 1
93         done &&
94         test_must_fail git rev-parse --verify "HEAD^$i" &&
95         test_cmp parents.expected parents.actual
96 }
97
98 verify_mergeheads () {
99         printf '%s\n' "$@" >mergehead.expected &&
100         while read sha1 rest
101         do
102                 git rev-parse $sha1
103         done <.git/MERGE_HEAD >mergehead.actual &&
104         test_cmp mergehead.expected mergehead.actual
105 }
106
107 verify_no_mergehead () {
108         ! test -e .git/MERGE_HEAD
109 }
110
111 test_expect_success 'setup' '
112         git add file &&
113         test_tick &&
114         git commit -m "commit 0" &&
115         git tag c0 &&
116         c0=$(git rev-parse HEAD) &&
117         cp file.1 file &&
118         git add file &&
119         test_tick &&
120         git commit -m "commit 1" &&
121         git tag c1 &&
122         c1=$(git rev-parse HEAD) &&
123         git reset --hard "$c0" &&
124         cp file.5 file &&
125         git add file &&
126         test_tick &&
127         git commit -m "commit 2" &&
128         git tag c2 &&
129         c2=$(git rev-parse HEAD) &&
130         git reset --hard "$c0" &&
131         cp file.9 file &&
132         git add file &&
133         test_tick &&
134         git commit -m "commit 3" &&
135         git tag c3 &&
136         c3=$(git rev-parse HEAD) &&
137         git reset --hard "$c0" &&
138         create_merge_msgs
139 '
140
141 test_debug 'git log --graph --decorate --oneline --all'
142
143 test_expect_success 'test option parsing' '
144         test_must_fail git merge -$ c1 &&
145         test_must_fail git merge --no-such c1 &&
146         test_must_fail git merge -s foobar c1 &&
147         test_must_fail git merge -s=foobar c1 &&
148         test_must_fail git merge -m &&
149         test_must_fail git merge
150 '
151
152 test_expect_success 'merge -h with invalid index' '
153         mkdir broken &&
154         (
155                 cd broken &&
156                 git init &&
157                 >.git/index &&
158                 test_expect_code 129 git merge -h 2>usage
159         ) &&
160         test_i18ngrep "[Uu]sage: git merge" broken/usage
161 '
162
163 test_expect_success 'reject non-strategy with a git-merge-foo name' '
164         test_must_fail git merge -s index c1
165 '
166
167 test_expect_success 'merge c0 with c1' '
168         echo "OBJID HEAD@{0}: merge c1: Fast-forward" >reflog.expected &&
169
170         git reset --hard c0 &&
171         git merge c1 &&
172         verify_merge file result.1 &&
173         verify_head "$c1" &&
174
175         git reflog -1 >reflog.actual &&
176         sed "s/$_x05[0-9a-f]*/OBJID/g" reflog.actual >reflog.fuzzy &&
177         test_cmp reflog.expected reflog.fuzzy
178 '
179
180 test_debug 'git log --graph --decorate --oneline --all'
181
182 test_expect_success 'merge c0 with c1 with --ff-only' '
183         git reset --hard c0 &&
184         git merge --ff-only c1 &&
185         git merge --ff-only HEAD c0 c1 &&
186         verify_merge file result.1 &&
187         verify_head "$c1"
188 '
189
190 test_debug 'git log --graph --decorate --oneline --all'
191
192 test_expect_success 'merge from unborn branch' '
193         git checkout -f master &&
194         test_might_fail git branch -D kid &&
195
196         echo "OBJID HEAD@{0}: initial pull" >reflog.expected &&
197
198         git checkout --orphan kid &&
199         test_when_finished "git checkout -f master" &&
200         git rm -fr . &&
201         test_tick &&
202         git merge --ff-only c1 &&
203         verify_merge file result.1 &&
204         verify_head "$c1" &&
205
206         git reflog -1 >reflog.actual &&
207         sed "s/$_x05[0-9a-f][0-9a-f]/OBJID/g" reflog.actual >reflog.fuzzy &&
208         test_cmp reflog.expected reflog.fuzzy
209 '
210
211 test_debug 'git log --graph --decorate --oneline --all'
212
213 test_expect_success 'merge c1 with c2' '
214         git reset --hard c1 &&
215         test_tick &&
216         git merge c2 &&
217         verify_merge file result.1-5 msg.1-5 &&
218         verify_parents $c1 $c2
219 '
220
221 test_debug 'git log --graph --decorate --oneline --all'
222
223 test_expect_success 'merge c1 with c2 and c3' '
224         git reset --hard c1 &&
225         test_tick &&
226         git merge c2 c3 &&
227         verify_merge file result.1-5-9 msg.1-5-9 &&
228         verify_parents $c1 $c2 $c3
229 '
230
231 test_debug 'git log --graph --decorate --oneline --all'
232
233 test_expect_success 'merges with --ff-only' '
234         git reset --hard c1 &&
235         test_tick &&
236         test_must_fail git merge --ff-only c2 &&
237         test_must_fail git merge --ff-only c3 &&
238         test_must_fail git merge --ff-only c2 c3 &&
239         git reset --hard c0 &&
240         git merge c3 &&
241         verify_head $c3
242 '
243
244 test_expect_success 'merges with merge.ff=only' '
245         git reset --hard c1 &&
246         test_tick &&
247         test_config merge.ff "only" &&
248         test_must_fail git merge c2 &&
249         test_must_fail git merge c3 &&
250         test_must_fail git merge c2 c3 &&
251         git reset --hard c0 &&
252         git merge c3 &&
253         verify_head $c3
254 '
255
256 test_expect_success 'merge c0 with c1 (no-commit)' '
257         git reset --hard c0 &&
258         git merge --no-commit c1 &&
259         verify_merge file result.1 &&
260         verify_head $c1
261 '
262
263 test_debug 'git log --graph --decorate --oneline --all'
264
265 test_expect_success 'merge c1 with c2 (no-commit)' '
266         git reset --hard c1 &&
267         git merge --no-commit c2 &&
268         verify_merge file result.1-5 &&
269         verify_head $c1 &&
270         verify_mergeheads $c2
271 '
272
273 test_debug 'git log --graph --decorate --oneline --all'
274
275 test_expect_success 'merge c1 with c2 and c3 (no-commit)' '
276         git reset --hard c1 &&
277         git merge --no-commit c2 c3 &&
278         verify_merge file result.1-5-9 &&
279         verify_head $c1 &&
280         verify_mergeheads $c2 $c3
281 '
282
283 test_debug 'git log --graph --decorate --oneline --all'
284
285 test_expect_success 'merge c0 with c1 (squash)' '
286         git reset --hard c0 &&
287         git merge --squash c1 &&
288         verify_merge file result.1 &&
289         verify_head $c0 &&
290         verify_no_mergehead &&
291         test_cmp squash.1 .git/SQUASH_MSG
292 '
293
294 test_debug 'git log --graph --decorate --oneline --all'
295
296 test_expect_success 'merge c0 with c1 (squash, ff-only)' '
297         git reset --hard c0 &&
298         git merge --squash --ff-only c1 &&
299         verify_merge file result.1 &&
300         verify_head $c0 &&
301         verify_no_mergehead &&
302         test_cmp squash.1 .git/SQUASH_MSG
303 '
304
305 test_debug 'git log --graph --decorate --oneline --all'
306
307 test_expect_success 'merge c1 with c2 (squash)' '
308         git reset --hard c1 &&
309         git merge --squash c2 &&
310         verify_merge file result.1-5 &&
311         verify_head $c1 &&
312         verify_no_mergehead &&
313         test_cmp squash.1-5 .git/SQUASH_MSG
314 '
315
316 test_debug 'git log --graph --decorate --oneline --all'
317
318 test_expect_success 'unsuccessful merge of c1 with c2 (squash, ff-only)' '
319         git reset --hard c1 &&
320         test_must_fail git merge --squash --ff-only c2
321 '
322
323 test_debug 'git log --graph --decorate --oneline --all'
324
325 test_expect_success 'merge c1 with c2 and c3 (squash)' '
326         git reset --hard c1 &&
327         git merge --squash c2 c3 &&
328         verify_merge file result.1-5-9 &&
329         verify_head $c1 &&
330         verify_no_mergehead &&
331         test_cmp squash.1-5-9 .git/SQUASH_MSG
332 '
333
334 test_debug 'git log --graph --decorate --oneline --all'
335
336 test_expect_success 'merge c1 with c2 (no-commit in config)' '
337         git reset --hard c1 &&
338         test_config branch.master.mergeoptions "--no-commit" &&
339         git merge c2 &&
340         verify_merge file result.1-5 &&
341         verify_head $c1 &&
342         verify_mergeheads $c2
343 '
344
345 test_debug 'git log --graph --decorate --oneline --all'
346
347 test_expect_success 'merge c1 with c2 (log in config)' '
348         git reset --hard c1 &&
349         git merge --log c2 &&
350         git show -s --pretty=tformat:%s%n%b >expect &&
351
352         test_config branch.master.mergeoptions "--log" &&
353         git reset --hard c1 &&
354         git merge c2 &&
355         git show -s --pretty=tformat:%s%n%b >actual &&
356
357         test_cmp expect actual
358 '
359
360 test_expect_success 'merge c1 with c2 (log in config gets overridden)' '
361         git reset --hard c1 &&
362         git merge c2 &&
363         git show -s --pretty=tformat:%s%n%b >expect &&
364
365         test_config branch.master.mergeoptions "--no-log" &&
366         test_config merge.log "true" &&
367         git reset --hard c1 &&
368         git merge c2 &&
369         git show -s --pretty=tformat:%s%n%b >actual &&
370
371         test_cmp expect actual
372 '
373
374 test_expect_success 'merge c1 with c2 (squash in config)' '
375         git reset --hard c1 &&
376         test_config branch.master.mergeoptions "--squash" &&
377         git merge c2 &&
378         verify_merge file result.1-5 &&
379         verify_head $c1 &&
380         verify_no_mergehead &&
381         test_cmp squash.1-5 .git/SQUASH_MSG
382 '
383
384 test_debug 'git log --graph --decorate --oneline --all'
385
386 test_expect_success 'override config option -n with --summary' '
387         git reset --hard c1 &&
388         test_config branch.master.mergeoptions "-n" &&
389         test_tick &&
390         git merge --summary c2 >diffstat.txt &&
391         verify_merge file result.1-5 msg.1-5 &&
392         verify_parents $c1 $c2 &&
393         if ! grep "^ file |  *2 +-$" diffstat.txt
394         then
395                 echo "[OOPS] diffstat was not generated with --summary"
396                 false
397         fi
398 '
399
400 test_expect_success 'override config option -n with --stat' '
401         git reset --hard c1 &&
402         test_config branch.master.mergeoptions "-n" &&
403         test_tick &&
404         git merge --stat c2 >diffstat.txt &&
405         verify_merge file result.1-5 msg.1-5 &&
406         verify_parents $c1 $c2 &&
407         if ! grep "^ file |  *2 +-$" diffstat.txt
408         then
409                 echo "[OOPS] diffstat was not generated with --stat"
410                 false
411         fi
412 '
413
414 test_debug 'git log --graph --decorate --oneline --all'
415
416 test_expect_success 'override config option --stat' '
417         git reset --hard c1 &&
418         test_config branch.master.mergeoptions "--stat" &&
419         test_tick &&
420         git merge -n c2 >diffstat.txt &&
421         verify_merge file result.1-5 msg.1-5 &&
422         verify_parents $c1 $c2 &&
423         if grep "^ file |  *2 +-$" diffstat.txt
424         then
425                 echo "[OOPS] diffstat was generated"
426                 false
427         fi
428 '
429
430 test_debug 'git log --graph --decorate --oneline --all'
431
432 test_expect_success 'merge c1 with c2 (override --no-commit)' '
433         git reset --hard c1 &&
434         test_config branch.master.mergeoptions "--no-commit" &&
435         test_tick &&
436         git merge --commit c2 &&
437         verify_merge file result.1-5 msg.1-5 &&
438         verify_parents $c1 $c2
439 '
440
441 test_debug 'git log --graph --decorate --oneline --all'
442
443 test_expect_success 'merge c1 with c2 (override --squash)' '
444         git reset --hard c1 &&
445         test_config branch.master.mergeoptions "--squash" &&
446         test_tick &&
447         git merge --no-squash c2 &&
448         verify_merge file result.1-5 msg.1-5 &&
449         verify_parents $c1 $c2
450 '
451
452 test_debug 'git log --graph --decorate --oneline --all'
453
454 test_expect_success 'merge c0 with c1 (no-ff)' '
455         git reset --hard c0 &&
456         test_tick &&
457         git merge --no-ff c1 &&
458         verify_merge file result.1 &&
459         verify_parents $c0 $c1
460 '
461
462 test_debug 'git log --graph --decorate --oneline --all'
463
464 test_expect_success 'merge c0 with c1 (--reverse)' '
465         git reset --hard c0 &&
466         test_tick &&
467         git merge --no-ff --reverse c1 &&
468         verify_merge file result.1 &&
469         verify_parents $c1 $c0
470 '
471
472 test_debug 'git log --graph --decorate --oneline --all'
473
474 test_expect_success 'merge c0 with c1 (merge.ff=false)' '
475         git reset --hard c0 &&
476         test_config merge.ff "false" &&
477         test_tick &&
478         git merge c1 &&
479         verify_merge file result.1 &&
480         verify_parents $c0 $c1
481 '
482 test_debug 'git log --graph --decorate --oneline --all'
483
484 test_expect_success 'combine branch.master.mergeoptions with merge.ff' '
485         git reset --hard c0 &&
486         test_config branch.master.mergeoptions "--ff" &&
487         test_config merge.ff "false" &&
488         test_tick &&
489         git merge c1 &&
490         verify_merge file result.1 &&
491         verify_parents "$c0"
492 '
493
494 test_expect_success 'tolerate unknown values for merge.ff' '
495         git reset --hard c0 &&
496         test_config merge.ff "something-new" &&
497         test_tick &&
498         git merge c1 2>message &&
499         verify_head "$c1" &&
500         test_cmp empty message
501 '
502
503 test_expect_success 'combining --squash and --no-ff is refused' '
504         git reset --hard c0 &&
505         test_must_fail git merge --squash --no-ff c1 &&
506         test_must_fail git merge --no-ff --squash c1
507 '
508
509 test_expect_success 'option --ff-only overwrites --no-ff' '
510         git merge --no-ff --ff-only c1 &&
511         test_must_fail git merge --no-ff --ff-only c2
512 '
513
514 test_expect_success 'option --no-ff overrides merge.ff=only config' '
515         git reset --hard c0 &&
516         test_config merge.ff only &&
517         git merge --no-ff c1
518 '
519
520 test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
521         git reset --hard c0 &&
522         test_config branch.master.mergeoptions "--no-ff" &&
523         git merge --ff c1 &&
524         verify_merge file result.1 &&
525         verify_head $c1
526 '
527
528 test_expect_success 'merge log message' '
529         git reset --hard c0 &&
530         git merge --no-log c2 &&
531         git show -s --pretty=format:%b HEAD >msg.act &&
532         test_cmp msg.nologff msg.act &&
533
534         git reset --hard c0 &&
535         test_config branch.master.mergeoptions "--no-ff" &&
536         git merge --no-log c2 &&
537         git show -s --pretty=format:%b HEAD >msg.act &&
538         test_cmp msg.nolognoff msg.act &&
539
540         git merge --log c3 &&
541         git show -s --pretty=format:%b HEAD >msg.act &&
542         test_cmp msg.log msg.act &&
543
544         git reset --hard HEAD^ &&
545         test_config merge.log "yes" &&
546         git merge c3 &&
547         git show -s --pretty=format:%b HEAD >msg.act &&
548         test_cmp msg.log msg.act
549 '
550
551 test_debug 'git log --graph --decorate --oneline --all'
552
553 test_expect_success 'merge c1 with c0, c2, c0, and c1' '
554        git reset --hard c1 &&
555        test_tick &&
556        git merge c0 c2 c0 c1 &&
557        verify_merge file result.1-5 &&
558        verify_parents $c1 $c2
559 '
560
561 test_debug 'git log --graph --decorate --oneline --all'
562
563 test_expect_success 'merge c1 with c0, c2, c0, and c1' '
564        git reset --hard c1 &&
565        test_tick &&
566        git merge c0 c2 c0 c1 &&
567        verify_merge file result.1-5 &&
568        verify_parents $c1 $c2
569 '
570
571 test_debug 'git log --graph --decorate --oneline --all'
572
573 test_expect_success 'merge c1 with c1 and c2' '
574        git reset --hard c1 &&
575        test_tick &&
576        git merge c1 c2 &&
577        verify_merge file result.1-5 &&
578        verify_parents $c1 $c2
579 '
580
581 test_debug 'git log --graph --decorate --oneline --all'
582
583 test_expect_success 'merge fast-forward in a dirty tree' '
584        git reset --hard c0 &&
585        mv file file1 &&
586        cat file1 >file &&
587        rm -f file1 &&
588        git merge c2
589 '
590
591 test_debug 'git log --graph --decorate --oneline --all'
592
593 test_expect_success 'in-index merge' '
594         git reset --hard c0 &&
595         git merge --no-ff -s resolve c1 >out &&
596         test_i18ngrep "Wonderful." out &&
597         verify_parents $c0 $c1
598 '
599
600 test_debug 'git log --graph --decorate --oneline --all'
601
602 test_expect_success 'refresh the index before merging' '
603         git reset --hard c1 &&
604         cp file file.n && mv -f file.n file &&
605         git merge c3
606 '
607
608 cat >expected.branch <<\EOF
609 Merge branch 'c5-branch' (early part)
610 EOF
611 cat >expected.tag <<\EOF
612 Merge commit 'c5~1'
613 EOF
614
615 test_expect_success 'merge early part of c2' '
616         git reset --hard c3 &&
617         echo c4 >c4.c &&
618         git add c4.c &&
619         git commit -m c4 &&
620         git tag c4 &&
621         echo c5 >c5.c &&
622         git add c5.c &&
623         git commit -m c5 &&
624         git tag c5 &&
625         git reset --hard c3 &&
626         echo c6 >c6.c &&
627         git add c6.c &&
628         git commit -m c6 &&
629         git tag c6 &&
630         git branch -f c5-branch c5 &&
631         git merge c5-branch~1 &&
632         git show -s --pretty=tformat:%s HEAD >actual.branch &&
633         git reset --keep HEAD^ &&
634         git merge c5~1 &&
635         git show -s --pretty=tformat:%s HEAD >actual.tag &&
636         test_cmp expected.branch actual.branch &&
637         test_cmp expected.tag actual.tag
638 '
639
640 test_debug 'git log --graph --decorate --oneline --all'
641
642 test_expect_success 'merge --no-ff --no-commit && commit' '
643         git reset --hard c0 &&
644         git merge --no-ff --no-commit c1 &&
645         EDITOR=: git commit &&
646         verify_parents $c0 $c1
647 '
648
649 test_debug 'git log --graph --decorate --oneline --all'
650
651 test_expect_success 'amending no-ff merge commit' '
652         EDITOR=: git commit --amend &&
653         verify_parents $c0 $c1
654 '
655
656 test_debug 'git log --graph --decorate --oneline --all'
657
658 cat >editor <<\EOF
659 #!/bin/sh
660 # Add a new message string that was not in the template
661 (
662         echo "Merge work done on the side branch c1"
663         echo
664         cat <"$1"
665 ) >"$1.tmp" && mv "$1.tmp" "$1"
666 # strip comments and blank lines from end of message
667 sed -e '/^#/d' < "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > expected
668 EOF
669 chmod 755 editor
670
671 test_expect_success 'merge --no-ff --edit' '
672         git reset --hard c0 &&
673         EDITOR=./editor git merge --no-ff --edit c1 &&
674         verify_parents $c0 $c1 &&
675         git cat-file commit HEAD >raw &&
676         grep "work done on the side branch" raw &&
677         sed "1,/^$/d" >actual raw &&
678         test_cmp actual expected
679 '
680
681 test_expect_success 'merge --reverse --no-commit && commit' '
682         git reset --hard c0 &&
683         git merge --no-ff --reverse --no-commit c1 &&
684         EDITOR=: git commit &&
685         verify_parents $c1 $c0
686 '
687
688 test_debug 'git log --graph --decorate --oneline --all'
689
690 test_expect_success 'amending reverse merge commit' '
691         EDITOR=: git commit --amend &&
692         verify_parents $c1 $c0
693 '
694
695 test_debug 'git log --graph --decorate --oneline --all'
696
697 test_expect_success GPG 'merge --ff-only tag' '
698         git reset --hard c0 &&
699         git commit --allow-empty -m "A newer commit" &&
700         git tag -s -m "A newer commit" signed &&
701         git reset --hard c0 &&
702
703         git merge --ff-only signed &&
704         git rev-parse signed^0 >expect &&
705         git rev-parse HEAD >actual &&
706         test_cmp actual expect
707 '
708
709 test_expect_success GPG 'merge --no-edit tag should skip editor' '
710         git reset --hard c0 &&
711         git commit --allow-empty -m "A newer commit" &&
712         git tag -f -s -m "A newer commit" signed &&
713         git reset --hard c0 &&
714
715         EDITOR=false git merge --no-edit signed &&
716         git rev-parse signed^0 >expect &&
717         git rev-parse HEAD^2 >actual &&
718         test_cmp actual expect
719 '
720
721 test_expect_success 'set up mod-256 conflict scenario' '
722         # 256 near-identical stanzas...
723         for i in $(test_seq 1 256); do
724                 for j in 1 2 3 4 5; do
725                         echo $i-$j
726                 done
727         done >file &&
728         git add file &&
729         git commit -m base &&
730
731         # one side changes the first line of each to "master"
732         sed s/-1/-master/ <file >tmp &&
733         mv tmp file &&
734         git commit -am master &&
735
736         # and the other to "side"; merging the two will
737         # yield 256 separate conflicts
738         git checkout -b side HEAD^ &&
739         sed s/-1/-side/ <file >tmp &&
740         mv tmp file &&
741         git commit -am side
742 '
743
744 test_expect_success 'merge detects mod-256 conflicts (recursive)' '
745         git reset --hard &&
746         test_must_fail git merge -s recursive master
747 '
748
749 test_expect_success 'merge detects mod-256 conflicts (resolve)' '
750         git reset --hard &&
751         test_must_fail git merge -s resolve master
752 '
753
754 test_done