Merge branch 'mn/send-email-credential-doc'
[git/debian.git] / t / t7600-merge.sh
blob6736d8d13139c946b07165d5bbad6c8d14617cbd
1 #!/bin/sh
3 # Copyright (c) 2007 Lars Hjemli
6 test_description='git merge
8 Testing basic merge operations/option parsing.
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
29 . ./test-lib.sh
30 . "$TEST_DIRECTORY"/lib-gpg.sh
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 2 3 4 5 6 7 8 '9 Y' >file.9y
37 printf '%s\n' '1 X' 2 3 4 5 6 7 8 9 >result.1
38 printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 9 >result.1-5
39 printf '%s\n' '1 X' 2 3 4 '5 X' 6 7 8 '9 X' >result.1-5-9
40 printf '%s\n' 1 2 3 4 5 6 7 8 '9 Z' >result.9z
41 >empty
43 create_merge_msgs () {
44 echo "Merge tag 'c2'" >msg.1-5 &&
45 echo "Merge tags 'c2' and 'c3'" >msg.1-5-9 &&
47 echo "Squashed commit of the following:" &&
48 echo &&
49 git log --no-merges ^HEAD c1
50 } >squash.1 &&
52 echo "Squashed commit of the following:" &&
53 echo &&
54 git log --no-merges ^HEAD c2
55 } >squash.1-5 &&
57 echo "Squashed commit of the following:" &&
58 echo &&
59 git log --no-merges ^HEAD c2 c3
60 } >squash.1-5-9 &&
61 : >msg.nologff &&
62 : >msg.nolognoff &&
64 echo "* tag 'c3':" &&
65 echo " commit 3"
66 } >msg.log
69 verify_merge () {
70 test_cmp "$2" "$1" &&
71 git update-index --refresh &&
72 git diff --exit-code &&
73 if test -n "$3"
74 then
75 git show -s --pretty=tformat:%s HEAD >msg.act &&
76 test_cmp "$3" msg.act
80 verify_head () {
81 echo "$1" >head.expected &&
82 git rev-parse HEAD >head.actual &&
83 test_cmp head.expected head.actual
86 verify_parents () {
87 printf '%s\n' "$@" >parents.expected &&
88 >parents.actual &&
89 i=1 &&
90 while test $i -le $#
92 git rev-parse HEAD^$i >>parents.actual &&
93 i=$(expr $i + 1) ||
94 return 1
95 done &&
96 test_must_fail git rev-parse --verify "HEAD^$i" &&
97 test_cmp parents.expected parents.actual
100 verify_mergeheads () {
101 printf '%s\n' "$@" >mergehead.expected &&
102 while read sha1 rest
104 git rev-parse $sha1
105 done <.git/MERGE_HEAD >mergehead.actual &&
106 test_cmp mergehead.expected mergehead.actual
109 verify_no_mergehead () {
110 ! test -e .git/MERGE_HEAD
113 test_expect_success 'setup' '
114 git add file &&
115 test_tick &&
116 git commit -m "commit 0" &&
117 git tag c0 &&
118 c0=$(git rev-parse HEAD) &&
119 cp file.1 file &&
120 git add file &&
121 test_tick &&
122 git commit -m "commit 1" &&
123 git tag c1 &&
124 c1=$(git rev-parse HEAD) &&
125 git reset --hard "$c0" &&
126 cp file.5 file &&
127 git add file &&
128 test_tick &&
129 git commit -m "commit 2" &&
130 git tag c2 &&
131 c2=$(git rev-parse HEAD) &&
132 git reset --hard "$c0" &&
133 cp file.9y file &&
134 git add file &&
135 test_tick &&
136 git commit -m "commit 7" &&
137 git tag c7 &&
138 git reset --hard "$c0" &&
139 cp file.9 file &&
140 git add file &&
141 test_tick &&
142 git commit -m "commit 3" &&
143 git tag c3 &&
144 c3=$(git rev-parse HEAD) &&
145 git reset --hard "$c0" &&
146 create_merge_msgs
149 test_debug 'git log --graph --decorate --oneline --all'
151 test_expect_success 'test option parsing' '
152 test_must_fail git merge -$ c1 &&
153 test_must_fail git merge --no-such c1 &&
154 test_must_fail git merge -s foobar c1 &&
155 test_must_fail git merge -s=foobar c1 &&
156 test_must_fail git merge -m &&
157 test_must_fail git merge --abort foobar &&
158 test_must_fail git merge --abort --quiet &&
159 test_must_fail git merge --continue foobar &&
160 test_must_fail git merge --continue --quiet &&
161 test_must_fail git merge
164 test_expect_success 'merge -h with invalid index' '
165 mkdir broken &&
167 cd broken &&
168 git init &&
169 >.git/index &&
170 test_expect_code 129 git merge -h 2>usage
171 ) &&
172 test_i18ngrep "[Uu]sage: git merge" broken/usage
175 test_expect_success 'reject non-strategy with a git-merge-foo name' '
176 test_must_fail git merge -s index c1
179 test_expect_success 'merge c0 with c1' '
180 echo "OBJID HEAD@{0}: merge c1: Fast-forward" >reflog.expected &&
182 git reset --hard c0 &&
183 git merge c1 &&
184 verify_merge file result.1 &&
185 verify_head "$c1" &&
187 git reflog -1 >reflog.actual &&
188 sed "s/$_x05[0-9a-f]*/OBJID/g" reflog.actual >reflog.fuzzy &&
189 test_cmp reflog.expected reflog.fuzzy
192 test_debug 'git log --graph --decorate --oneline --all'
194 test_expect_success 'merge c0 with c1 with --ff-only' '
195 git reset --hard c0 &&
196 git merge --ff-only c1 &&
197 git merge --ff-only HEAD c0 c1 &&
198 verify_merge file result.1 &&
199 verify_head "$c1"
202 test_debug 'git log --graph --decorate --oneline --all'
204 test_expect_success 'merge from unborn branch' '
205 git checkout -f master &&
206 test_might_fail git branch -D kid &&
208 echo "OBJID HEAD@{0}: initial pull" >reflog.expected &&
210 git checkout --orphan kid &&
211 test_when_finished "git checkout -f master" &&
212 git rm -fr . &&
213 test_tick &&
214 git merge --ff-only c1 &&
215 verify_merge file result.1 &&
216 verify_head "$c1" &&
218 git reflog -1 >reflog.actual &&
219 sed "s/$_x05[0-9a-f][0-9a-f]/OBJID/g" reflog.actual >reflog.fuzzy &&
220 test_cmp reflog.expected reflog.fuzzy
223 test_debug 'git log --graph --decorate --oneline --all'
225 test_expect_success 'merge c1 with c2' '
226 git reset --hard c1 &&
227 test_tick &&
228 git merge c2 &&
229 verify_merge file result.1-5 msg.1-5 &&
230 verify_parents $c1 $c2
233 test_expect_success 'merge --squash c3 with c7' '
234 git reset --hard c3 &&
235 test_must_fail git merge --squash c7 &&
236 cat result.9z >file &&
237 git commit --no-edit -a &&
240 cat <<-EOF
241 Squashed commit of the following:
243 $(git show -s c7)
245 # Conflicts:
246 # file
248 } >expect &&
249 git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
250 test_cmp expect actual
253 test_debug 'git log --graph --decorate --oneline --all'
255 test_expect_success 'merge c1 with c2 and c3' '
256 git reset --hard c1 &&
257 test_tick &&
258 git merge c2 c3 &&
259 verify_merge file result.1-5-9 msg.1-5-9 &&
260 verify_parents $c1 $c2 $c3
263 test_debug 'git log --graph --decorate --oneline --all'
265 test_expect_success 'merges with --ff-only' '
266 git reset --hard c1 &&
267 test_tick &&
268 test_must_fail git merge --ff-only c2 &&
269 test_must_fail git merge --ff-only c3 &&
270 test_must_fail git merge --ff-only c2 c3 &&
271 git reset --hard c0 &&
272 git merge c3 &&
273 verify_head $c3
276 test_expect_success 'merges with merge.ff=only' '
277 git reset --hard c1 &&
278 test_tick &&
279 test_config merge.ff "only" &&
280 test_must_fail git merge c2 &&
281 test_must_fail git merge c3 &&
282 test_must_fail git merge c2 c3 &&
283 git reset --hard c0 &&
284 git merge c3 &&
285 verify_head $c3
288 test_expect_success 'merge c0 with c1 (no-commit)' '
289 git reset --hard c0 &&
290 git merge --no-commit c1 &&
291 verify_merge file result.1 &&
292 verify_head $c1
295 test_debug 'git log --graph --decorate --oneline --all'
297 test_expect_success 'merge c1 with c2 (no-commit)' '
298 git reset --hard c1 &&
299 git merge --no-commit c2 &&
300 verify_merge file result.1-5 &&
301 verify_head $c1 &&
302 verify_mergeheads $c2
305 test_debug 'git log --graph --decorate --oneline --all'
307 test_expect_success 'merge c1 with c2 and c3 (no-commit)' '
308 git reset --hard c1 &&
309 git merge --no-commit c2 c3 &&
310 verify_merge file result.1-5-9 &&
311 verify_head $c1 &&
312 verify_mergeheads $c2 $c3
315 test_debug 'git log --graph --decorate --oneline --all'
317 test_expect_success 'merge c0 with c1 (squash)' '
318 git reset --hard c0 &&
319 git merge --squash c1 &&
320 verify_merge file result.1 &&
321 verify_head $c0 &&
322 verify_no_mergehead &&
323 test_cmp squash.1 .git/SQUASH_MSG
326 test_debug 'git log --graph --decorate --oneline --all'
328 test_expect_success 'merge c0 with c1 (squash, ff-only)' '
329 git reset --hard c0 &&
330 git merge --squash --ff-only c1 &&
331 verify_merge file result.1 &&
332 verify_head $c0 &&
333 verify_no_mergehead &&
334 test_cmp squash.1 .git/SQUASH_MSG
337 test_debug 'git log --graph --decorate --oneline --all'
339 test_expect_success 'merge c1 with c2 (squash)' '
340 git reset --hard c1 &&
341 git merge --squash c2 &&
342 verify_merge file result.1-5 &&
343 verify_head $c1 &&
344 verify_no_mergehead &&
345 test_cmp squash.1-5 .git/SQUASH_MSG
348 test_debug 'git log --graph --decorate --oneline --all'
350 test_expect_success 'unsuccessful merge of c1 with c2 (squash, ff-only)' '
351 git reset --hard c1 &&
352 test_must_fail git merge --squash --ff-only c2
355 test_debug 'git log --graph --decorate --oneline --all'
357 test_expect_success 'merge c1 with c2 and c3 (squash)' '
358 git reset --hard c1 &&
359 git merge --squash c2 c3 &&
360 verify_merge file result.1-5-9 &&
361 verify_head $c1 &&
362 verify_no_mergehead &&
363 test_cmp squash.1-5-9 .git/SQUASH_MSG
366 test_debug 'git log --graph --decorate --oneline --all'
368 test_expect_success 'merge c1 with c2 (no-commit in config)' '
369 git reset --hard c1 &&
370 test_config branch.master.mergeoptions "--no-commit" &&
371 git merge c2 &&
372 verify_merge file result.1-5 &&
373 verify_head $c1 &&
374 verify_mergeheads $c2
377 test_debug 'git log --graph --decorate --oneline --all'
379 test_expect_success 'merge c1 with c2 (log in config)' '
380 git reset --hard c1 &&
381 git merge --log c2 &&
382 git show -s --pretty=tformat:%s%n%b >expect &&
384 test_config branch.master.mergeoptions "--log" &&
385 git reset --hard c1 &&
386 git merge c2 &&
387 git show -s --pretty=tformat:%s%n%b >actual &&
389 test_cmp expect actual
392 test_expect_success 'merge c1 with c2 (log in config gets overridden)' '
393 git reset --hard c1 &&
394 git merge c2 &&
395 git show -s --pretty=tformat:%s%n%b >expect &&
397 test_config branch.master.mergeoptions "--no-log" &&
398 test_config merge.log "true" &&
399 git reset --hard c1 &&
400 git merge c2 &&
401 git show -s --pretty=tformat:%s%n%b >actual &&
403 test_cmp expect actual
406 test_expect_success 'merge c1 with c2 (squash in config)' '
407 git reset --hard c1 &&
408 test_config branch.master.mergeoptions "--squash" &&
409 git merge c2 &&
410 verify_merge file result.1-5 &&
411 verify_head $c1 &&
412 verify_no_mergehead &&
413 test_cmp squash.1-5 .git/SQUASH_MSG
416 test_debug 'git log --graph --decorate --oneline --all'
418 test_expect_success 'override config option -n with --summary' '
419 git reset --hard c1 &&
420 test_config branch.master.mergeoptions "-n" &&
421 test_tick &&
422 git merge --summary c2 >diffstat.txt &&
423 verify_merge file result.1-5 msg.1-5 &&
424 verify_parents $c1 $c2 &&
425 if ! grep "^ file | *2 +-$" diffstat.txt
426 then
427 echo "[OOPS] diffstat was not generated with --summary"
428 false
432 test_expect_success 'override config option -n with --stat' '
433 git reset --hard c1 &&
434 test_config branch.master.mergeoptions "-n" &&
435 test_tick &&
436 git merge --stat c2 >diffstat.txt &&
437 verify_merge file result.1-5 msg.1-5 &&
438 verify_parents $c1 $c2 &&
439 if ! grep "^ file | *2 +-$" diffstat.txt
440 then
441 echo "[OOPS] diffstat was not generated with --stat"
442 false
446 test_debug 'git log --graph --decorate --oneline --all'
448 test_expect_success 'override config option --stat' '
449 git reset --hard c1 &&
450 test_config branch.master.mergeoptions "--stat" &&
451 test_tick &&
452 git merge -n c2 >diffstat.txt &&
453 verify_merge file result.1-5 msg.1-5 &&
454 verify_parents $c1 $c2 &&
455 if grep "^ file | *2 +-$" diffstat.txt
456 then
457 echo "[OOPS] diffstat was generated"
458 false
462 test_debug 'git log --graph --decorate --oneline --all'
464 test_expect_success 'merge c1 with c2 (override --no-commit)' '
465 git reset --hard c1 &&
466 test_config branch.master.mergeoptions "--no-commit" &&
467 test_tick &&
468 git merge --commit c2 &&
469 verify_merge file result.1-5 msg.1-5 &&
470 verify_parents $c1 $c2
473 test_debug 'git log --graph --decorate --oneline --all'
475 test_expect_success 'merge c1 with c2 (override --squash)' '
476 git reset --hard c1 &&
477 test_config branch.master.mergeoptions "--squash" &&
478 test_tick &&
479 git merge --no-squash c2 &&
480 verify_merge file result.1-5 msg.1-5 &&
481 verify_parents $c1 $c2
484 test_debug 'git log --graph --decorate --oneline --all'
486 test_expect_success 'merge c0 with c1 (no-ff)' '
487 git reset --hard c0 &&
488 test_tick &&
489 git merge --no-ff c1 &&
490 verify_merge file result.1 &&
491 verify_parents $c0 $c1
494 test_debug 'git log --graph --decorate --oneline --all'
496 test_expect_success 'merge c0 with c1 (merge.ff=false)' '
497 git reset --hard c0 &&
498 test_config merge.ff "false" &&
499 test_tick &&
500 git merge c1 &&
501 verify_merge file result.1 &&
502 verify_parents $c0 $c1
504 test_debug 'git log --graph --decorate --oneline --all'
506 test_expect_success 'combine branch.master.mergeoptions with merge.ff' '
507 git reset --hard c0 &&
508 test_config branch.master.mergeoptions "--ff" &&
509 test_config merge.ff "false" &&
510 test_tick &&
511 git merge c1 &&
512 verify_merge file result.1 &&
513 verify_parents "$c0"
516 test_expect_success 'tolerate unknown values for merge.ff' '
517 git reset --hard c0 &&
518 test_config merge.ff "something-new" &&
519 test_tick &&
520 git merge c1 2>message &&
521 verify_head "$c1" &&
522 test_cmp empty message
525 test_expect_success 'combining --squash and --no-ff is refused' '
526 git reset --hard c0 &&
527 test_must_fail git merge --squash --no-ff c1 &&
528 test_must_fail git merge --no-ff --squash c1
531 test_expect_success 'option --ff-only overwrites --no-ff' '
532 git merge --no-ff --ff-only c1 &&
533 test_must_fail git merge --no-ff --ff-only c2
536 test_expect_success 'option --no-ff overrides merge.ff=only config' '
537 git reset --hard c0 &&
538 test_config merge.ff only &&
539 git merge --no-ff c1
542 test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
543 git reset --hard c0 &&
544 test_config branch.master.mergeoptions "--no-ff" &&
545 git merge --ff c1 &&
546 verify_merge file result.1 &&
547 verify_head $c1
550 test_expect_success 'merge log message' '
551 git reset --hard c0 &&
552 git merge --no-log c2 &&
553 git show -s --pretty=format:%b HEAD >msg.act &&
554 test_cmp msg.nologff msg.act &&
556 git reset --hard c0 &&
557 test_config branch.master.mergeoptions "--no-ff" &&
558 git merge --no-log c2 &&
559 git show -s --pretty=format:%b HEAD >msg.act &&
560 test_cmp msg.nolognoff msg.act &&
562 git merge --log c3 &&
563 git show -s --pretty=format:%b HEAD >msg.act &&
564 test_cmp msg.log msg.act &&
566 git reset --hard HEAD^ &&
567 test_config merge.log "yes" &&
568 git merge c3 &&
569 git show -s --pretty=format:%b HEAD >msg.act &&
570 test_cmp msg.log msg.act
573 test_debug 'git log --graph --decorate --oneline --all'
575 test_expect_success 'merge c1 with c0, c2, c0, and c1' '
576 git reset --hard c1 &&
577 test_tick &&
578 git merge c0 c2 c0 c1 &&
579 verify_merge file result.1-5 &&
580 verify_parents $c1 $c2
583 test_debug 'git log --graph --decorate --oneline --all'
585 test_expect_success 'merge c1 with c0, c2, c0, and c1' '
586 git reset --hard c1 &&
587 test_tick &&
588 git merge c0 c2 c0 c1 &&
589 verify_merge file result.1-5 &&
590 verify_parents $c1 $c2
593 test_debug 'git log --graph --decorate --oneline --all'
595 test_expect_success 'merge c1 with c1 and c2' '
596 git reset --hard c1 &&
597 test_tick &&
598 git merge c1 c2 &&
599 verify_merge file result.1-5 &&
600 verify_parents $c1 $c2
603 test_debug 'git log --graph --decorate --oneline --all'
605 test_expect_success 'merge fast-forward in a dirty tree' '
606 git reset --hard c0 &&
607 mv file file1 &&
608 cat file1 >file &&
609 rm -f file1 &&
610 git merge c2
613 test_debug 'git log --graph --decorate --oneline --all'
615 test_expect_success 'in-index merge' '
616 git reset --hard c0 &&
617 git merge --no-ff -s resolve c1 >out &&
618 test_i18ngrep "Wonderful." out &&
619 verify_parents $c0 $c1
622 test_debug 'git log --graph --decorate --oneline --all'
624 test_expect_success 'refresh the index before merging' '
625 git reset --hard c1 &&
626 cp file file.n && mv -f file.n file &&
627 git merge c3
630 cat >expected.branch <<\EOF
631 Merge branch 'c5-branch' (early part)
633 cat >expected.tag <<\EOF
634 Merge commit 'c5~1'
637 test_expect_success 'merge early part of c2' '
638 git reset --hard c3 &&
639 echo c4 >c4.c &&
640 git add c4.c &&
641 git commit -m c4 &&
642 git tag c4 &&
643 echo c5 >c5.c &&
644 git add c5.c &&
645 git commit -m c5 &&
646 git tag c5 &&
647 git reset --hard c3 &&
648 echo c6 >c6.c &&
649 git add c6.c &&
650 git commit -m c6 &&
651 git tag c6 &&
652 git branch -f c5-branch c5 &&
653 git merge c5-branch~1 &&
654 git show -s --pretty=tformat:%s HEAD >actual.branch &&
655 git reset --keep HEAD^ &&
656 git merge c5~1 &&
657 git show -s --pretty=tformat:%s HEAD >actual.tag &&
658 test_cmp expected.branch actual.branch &&
659 test_cmp expected.tag actual.tag
662 test_debug 'git log --graph --decorate --oneline --all'
664 test_expect_success 'merge --no-ff --no-commit && commit' '
665 git reset --hard c0 &&
666 git merge --no-ff --no-commit c1 &&
667 EDITOR=: git commit &&
668 verify_parents $c0 $c1
671 test_debug 'git log --graph --decorate --oneline --all'
673 test_expect_success 'amending no-ff merge commit' '
674 EDITOR=: git commit --amend &&
675 verify_parents $c0 $c1
678 test_debug 'git log --graph --decorate --oneline --all'
680 cat >editor <<\EOF
681 #!/bin/sh
682 # Add a new message string that was not in the template
684 echo "Merge work done on the side branch c1"
685 echo
686 cat <"$1"
687 ) >"$1.tmp" && mv "$1.tmp" "$1"
688 # strip comments and blank lines from end of message
689 sed -e '/^#/d' < "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > expected
691 chmod 755 editor
693 test_expect_success 'merge --no-ff --edit' '
694 git reset --hard c0 &&
695 EDITOR=./editor git merge --no-ff --edit c1 &&
696 verify_parents $c0 $c1 &&
697 git cat-file commit HEAD >raw &&
698 grep "work done on the side branch" raw &&
699 sed "1,/^$/d" >actual raw &&
700 test_cmp expected actual
703 test_expect_success 'merge annotated/signed tag w/o tracking' '
704 test_when_finished "rm -rf dst; git tag -d anno1" &&
705 git tag -a -m "anno c1" anno1 c1 &&
706 git init dst &&
707 git rev-parse c1 >dst/expect &&
709 # c0 fast-forwards to c1 but because this repository
710 # is not a "downstream" whose refs/tags follows along
711 # tag from the "upstream", this pull defaults to --no-ff
712 cd dst &&
713 git pull .. c0 &&
714 git pull .. anno1 &&
715 git rev-parse HEAD^2 >actual &&
716 test_cmp expect actual
720 test_expect_success 'merge annotated/signed tag w/ tracking' '
721 test_when_finished "rm -rf dst; git tag -d anno1" &&
722 git tag -a -m "anno c1" anno1 c1 &&
723 git init dst &&
724 git rev-parse c1 >dst/expect &&
726 # c0 fast-forwards to c1 and because this repository
727 # is a "downstream" whose refs/tags follows along
728 # tag from the "upstream", this pull defaults to --ff
729 cd dst &&
730 git remote add origin .. &&
731 git pull origin c0 &&
732 git fetch origin &&
733 git merge anno1 &&
734 git rev-parse HEAD >actual &&
735 test_cmp expect actual
739 test_expect_success GPG 'merge --ff-only tag' '
740 git reset --hard c0 &&
741 git commit --allow-empty -m "A newer commit" &&
742 git tag -s -m "A newer commit" signed &&
743 git reset --hard c0 &&
745 git merge --ff-only signed &&
746 git rev-parse signed^0 >expect &&
747 git rev-parse HEAD >actual &&
748 test_cmp expect actual
751 test_expect_success GPG 'merge --no-edit tag should skip editor' '
752 git reset --hard c0 &&
753 git commit --allow-empty -m "A newer commit" &&
754 git tag -f -s -m "A newer commit" signed &&
755 git reset --hard c0 &&
757 EDITOR=false git merge --no-edit --no-ff signed &&
758 git rev-parse signed^0 >expect &&
759 git rev-parse HEAD^2 >actual &&
760 test_cmp expect actual
763 test_expect_success 'set up mod-256 conflict scenario' '
764 # 256 near-identical stanzas...
765 for i in $(test_seq 1 256); do
766 for j in 1 2 3 4 5; do
767 echo $i-$j
768 done
769 done >file &&
770 git add file &&
771 git commit -m base &&
773 # one side changes the first line of each to "master"
774 sed s/-1/-master/ <file >tmp &&
775 mv tmp file &&
776 git commit -am master &&
778 # and the other to "side"; merging the two will
779 # yield 256 separate conflicts
780 git checkout -b side HEAD^ &&
781 sed s/-1/-side/ <file >tmp &&
782 mv tmp file &&
783 git commit -am side
786 test_expect_success 'merge detects mod-256 conflicts (recursive)' '
787 git reset --hard &&
788 test_must_fail git merge -s recursive master
791 test_expect_success 'merge detects mod-256 conflicts (resolve)' '
792 git reset --hard &&
793 test_must_fail git merge -s resolve master
796 test_expect_success 'merge nothing into void' '
797 git init void &&
799 cd void &&
800 git remote add up .. &&
801 git fetch up &&
802 test_must_fail git merge FETCH_HEAD
806 test_expect_success 'merge can be completed with --continue' '
807 git reset --hard c0 &&
808 git merge --no-ff --no-commit c1 &&
809 git merge --continue &&
810 verify_parents $c0 $c1
813 write_script .git/FAKE_EDITOR <<EOF
814 # kill -TERM command added below.
817 test_expect_success EXECKEEPSPID 'killed merge can be completed with --continue' '
818 git reset --hard c0 &&
819 ! "$SHELL_PATH" -c '\''
820 echo kill -TERM $$ >> .git/FAKE_EDITOR
821 GIT_EDITOR=.git/FAKE_EDITOR
822 export GIT_EDITOR
823 exec git merge --no-ff --edit c1'\'' &&
824 git merge --continue &&
825 verify_parents $c0 $c1
828 test_done