README: adjust for final Azure Pipeline ID
[git/raj.git] / t / t7600-merge.sh
blob106148254d0ce067e8f5f842faac8fbf1ee90f15
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
42 create_merge_msgs () {
43 echo "Merge tag 'c2'" >msg.1-5 &&
44 echo "Merge tags 'c2' and 'c3'" >msg.1-5-9 &&
46 echo "Squashed commit of the following:" &&
47 echo &&
48 git log --no-merges ^HEAD c1
49 } >squash.1 &&
51 echo "Squashed commit of the following:" &&
52 echo &&
53 git log --no-merges ^HEAD c2
54 } >squash.1-5 &&
56 echo "Squashed commit of the following:" &&
57 echo &&
58 git log --no-merges ^HEAD c2 c3
59 } >squash.1-5-9 &&
61 echo "* tag 'c3':" &&
62 echo " commit 3"
63 } >msg.log
66 verify_merge () {
67 test_cmp "$2" "$1" &&
68 git update-index --refresh &&
69 git diff --exit-code &&
70 if test -n "$3"
71 then
72 git show -s --pretty=tformat:%s HEAD >msg.act &&
73 test_cmp "$3" msg.act
77 verify_head () {
78 echo "$1" >head.expected &&
79 git rev-parse HEAD >head.actual &&
80 test_cmp head.expected head.actual
83 verify_parents () {
84 printf '%s\n' "$@" >parents.expected &&
85 >parents.actual &&
86 i=1 &&
87 while test $i -le $#
89 git rev-parse HEAD^$i >>parents.actual &&
90 i=$(expr $i + 1) ||
91 return 1
92 done &&
93 test_must_fail git rev-parse --verify "HEAD^$i" &&
94 test_cmp parents.expected parents.actual
97 verify_mergeheads () {
98 printf '%s\n' "$@" >mergehead.expected &&
99 while read sha1 rest
101 git rev-parse $sha1
102 done <.git/MERGE_HEAD >mergehead.actual &&
103 test_cmp mergehead.expected mergehead.actual
106 verify_no_mergehead () {
107 ! test -e .git/MERGE_HEAD
110 test_expect_success 'setup' '
111 git add file &&
112 test_tick &&
113 git commit -m "commit 0" &&
114 git tag c0 &&
115 c0=$(git rev-parse HEAD) &&
116 cp file.1 file &&
117 git add file &&
118 test_tick &&
119 git commit -m "commit 1" &&
120 git tag c1 &&
121 c1=$(git rev-parse HEAD) &&
122 git reset --hard "$c0" &&
123 cp file.5 file &&
124 git add file &&
125 test_tick &&
126 git commit -m "commit 2" &&
127 git tag c2 &&
128 c2=$(git rev-parse HEAD) &&
129 git reset --hard "$c0" &&
130 cp file.9y file &&
131 git add file &&
132 test_tick &&
133 git commit -m "commit 7" &&
134 git tag c7 &&
135 git reset --hard "$c0" &&
136 cp file.9 file &&
137 git add file &&
138 test_tick &&
139 git commit -m "commit 3" &&
140 git tag c3 &&
141 c3=$(git rev-parse HEAD) &&
142 git reset --hard "$c0" &&
143 create_merge_msgs
146 test_debug 'git log --graph --decorate --oneline --all'
148 test_expect_success 'test option parsing' '
149 test_must_fail git merge -$ c1 &&
150 test_must_fail git merge --no-such c1 &&
151 test_must_fail git merge -s foobar c1 &&
152 test_must_fail git merge -s=foobar c1 &&
153 test_must_fail git merge -m &&
154 test_must_fail git merge --abort foobar &&
155 test_must_fail git merge --abort --quiet &&
156 test_must_fail git merge --continue foobar &&
157 test_must_fail git merge --continue --quiet &&
158 test_must_fail git merge
161 test_expect_success 'merge -h with invalid index' '
162 mkdir broken &&
164 cd broken &&
165 git init &&
166 >.git/index &&
167 test_expect_code 129 git merge -h 2>usage
168 ) &&
169 test_i18ngrep "[Uu]sage: git merge" broken/usage
172 test_expect_success 'reject non-strategy with a git-merge-foo name' '
173 test_must_fail git merge -s index c1
176 test_expect_success 'merge c0 with c1' '
177 echo "OBJID HEAD@{0}: merge c1: Fast-forward" >reflog.expected &&
179 git reset --hard c0 &&
180 git merge c1 &&
181 verify_merge file result.1 &&
182 verify_head "$c1" &&
184 git reflog -1 >reflog.actual &&
185 sed "s/$_x05[0-9a-f]*/OBJID/g" reflog.actual >reflog.fuzzy &&
186 test_cmp reflog.expected reflog.fuzzy
189 test_debug 'git log --graph --decorate --oneline --all'
191 test_expect_success 'merge c0 with c1 with --ff-only' '
192 git reset --hard c0 &&
193 git merge --ff-only c1 &&
194 git merge --ff-only HEAD c0 c1 &&
195 verify_merge file result.1 &&
196 verify_head "$c1"
199 test_debug 'git log --graph --decorate --oneline --all'
201 test_expect_success 'merge from unborn branch' '
202 git checkout -f master &&
203 test_might_fail git branch -D kid &&
205 echo "OBJID HEAD@{0}: initial pull" >reflog.expected &&
207 git checkout --orphan kid &&
208 test_when_finished "git checkout -f master" &&
209 git rm -fr . &&
210 test_tick &&
211 git merge --ff-only c1 &&
212 verify_merge file result.1 &&
213 verify_head "$c1" &&
215 git reflog -1 >reflog.actual &&
216 sed "s/$_x05[0-9a-f][0-9a-f]/OBJID/g" reflog.actual >reflog.fuzzy &&
217 test_cmp reflog.expected reflog.fuzzy
220 test_debug 'git log --graph --decorate --oneline --all'
222 test_expect_success 'merge c1 with c2' '
223 git reset --hard c1 &&
224 test_tick &&
225 git merge c2 &&
226 verify_merge file result.1-5 msg.1-5 &&
227 verify_parents $c1 $c2
230 test_expect_success 'merge --squash c3 with c7' '
231 git reset --hard c3 &&
232 test_must_fail git merge --squash c7 &&
233 cat result.9z >file &&
234 git commit --no-edit -a &&
237 cat <<-EOF
238 Squashed commit of the following:
240 $(git show -s c7)
242 # Conflicts:
243 # file
245 } >expect &&
246 git cat-file commit HEAD | sed -e '1,/^$/d' >actual &&
247 test_cmp expect actual
250 test_debug 'git log --graph --decorate --oneline --all'
252 test_expect_success 'merge c1 with c2 and c3' '
253 git reset --hard c1 &&
254 test_tick &&
255 git merge c2 c3 &&
256 verify_merge file result.1-5-9 msg.1-5-9 &&
257 verify_parents $c1 $c2 $c3
260 test_debug 'git log --graph --decorate --oneline --all'
262 test_expect_success 'merges with --ff-only' '
263 git reset --hard c1 &&
264 test_tick &&
265 test_must_fail git merge --ff-only c2 &&
266 test_must_fail git merge --ff-only c3 &&
267 test_must_fail git merge --ff-only c2 c3 &&
268 git reset --hard c0 &&
269 git merge c3 &&
270 verify_head $c3
273 test_expect_success 'merges with merge.ff=only' '
274 git reset --hard c1 &&
275 test_tick &&
276 test_config merge.ff "only" &&
277 test_must_fail git merge c2 &&
278 test_must_fail git merge c3 &&
279 test_must_fail git merge c2 c3 &&
280 git reset --hard c0 &&
281 git merge c3 &&
282 verify_head $c3
285 test_expect_success 'merge c0 with c1 (no-commit)' '
286 git reset --hard c0 &&
287 git merge --no-commit c1 &&
288 verify_merge file result.1 &&
289 verify_head $c1
292 test_debug 'git log --graph --decorate --oneline --all'
294 test_expect_success 'merge c1 with c2 (no-commit)' '
295 git reset --hard c1 &&
296 git merge --no-commit c2 &&
297 verify_merge file result.1-5 &&
298 verify_head $c1 &&
299 verify_mergeheads $c2
302 test_debug 'git log --graph --decorate --oneline --all'
304 test_expect_success 'merge c1 with c2 and c3 (no-commit)' '
305 git reset --hard c1 &&
306 git merge --no-commit c2 c3 &&
307 verify_merge file result.1-5-9 &&
308 verify_head $c1 &&
309 verify_mergeheads $c2 $c3
312 test_debug 'git log --graph --decorate --oneline --all'
314 test_expect_success 'merge c0 with c1 (squash)' '
315 git reset --hard c0 &&
316 git merge --squash c1 &&
317 verify_merge file result.1 &&
318 verify_head $c0 &&
319 verify_no_mergehead &&
320 test_cmp squash.1 .git/SQUASH_MSG
323 test_debug 'git log --graph --decorate --oneline --all'
325 test_expect_success 'merge c0 with c1 (squash, ff-only)' '
326 git reset --hard c0 &&
327 git merge --squash --ff-only c1 &&
328 verify_merge file result.1 &&
329 verify_head $c0 &&
330 verify_no_mergehead &&
331 test_cmp squash.1 .git/SQUASH_MSG
334 test_debug 'git log --graph --decorate --oneline --all'
336 test_expect_success 'merge c1 with c2 (squash)' '
337 git reset --hard c1 &&
338 git merge --squash c2 &&
339 verify_merge file result.1-5 &&
340 verify_head $c1 &&
341 verify_no_mergehead &&
342 test_cmp squash.1-5 .git/SQUASH_MSG
345 test_debug 'git log --graph --decorate --oneline --all'
347 test_expect_success 'unsuccessful merge of c1 with c2 (squash, ff-only)' '
348 git reset --hard c1 &&
349 test_must_fail git merge --squash --ff-only c2
352 test_debug 'git log --graph --decorate --oneline --all'
354 test_expect_success 'merge c1 with c2 and c3 (squash)' '
355 git reset --hard c1 &&
356 git merge --squash c2 c3 &&
357 verify_merge file result.1-5-9 &&
358 verify_head $c1 &&
359 verify_no_mergehead &&
360 test_cmp squash.1-5-9 .git/SQUASH_MSG
363 test_debug 'git log --graph --decorate --oneline --all'
365 test_expect_success 'merge c1 with c2 (no-commit in config)' '
366 git reset --hard c1 &&
367 test_config branch.master.mergeoptions "--no-commit" &&
368 git merge c2 &&
369 verify_merge file result.1-5 &&
370 verify_head $c1 &&
371 verify_mergeheads $c2
374 test_debug 'git log --graph --decorate --oneline --all'
376 test_expect_success 'merge c1 with c2 (log in config)' '
377 git reset --hard c1 &&
378 git merge --log c2 &&
379 git show -s --pretty=tformat:%s%n%b >expect &&
381 test_config branch.master.mergeoptions "--log" &&
382 git reset --hard c1 &&
383 git merge c2 &&
384 git show -s --pretty=tformat:%s%n%b >actual &&
386 test_cmp expect actual
389 test_expect_success 'merge c1 with c2 (log in config gets overridden)' '
390 git reset --hard c1 &&
391 git merge c2 &&
392 git show -s --pretty=tformat:%s%n%b >expect &&
394 test_config branch.master.mergeoptions "--no-log" &&
395 test_config merge.log "true" &&
396 git reset --hard c1 &&
397 git merge c2 &&
398 git show -s --pretty=tformat:%s%n%b >actual &&
400 test_cmp expect actual
403 test_expect_success 'merge c1 with c2 (squash in config)' '
404 git reset --hard c1 &&
405 test_config branch.master.mergeoptions "--squash" &&
406 git merge c2 &&
407 verify_merge file result.1-5 &&
408 verify_head $c1 &&
409 verify_no_mergehead &&
410 test_cmp squash.1-5 .git/SQUASH_MSG
413 test_debug 'git log --graph --decorate --oneline --all'
415 test_expect_success 'override config option -n with --summary' '
416 git reset --hard c1 &&
417 test_config branch.master.mergeoptions "-n" &&
418 test_tick &&
419 git merge --summary c2 >diffstat.txt &&
420 verify_merge file result.1-5 msg.1-5 &&
421 verify_parents $c1 $c2 &&
422 if ! grep "^ file | *2 +-$" diffstat.txt
423 then
424 echo "[OOPS] diffstat was not generated with --summary"
425 false
429 test_expect_success 'override config option -n with --stat' '
430 git reset --hard c1 &&
431 test_config branch.master.mergeoptions "-n" &&
432 test_tick &&
433 git merge --stat c2 >diffstat.txt &&
434 verify_merge file result.1-5 msg.1-5 &&
435 verify_parents $c1 $c2 &&
436 if ! grep "^ file | *2 +-$" diffstat.txt
437 then
438 echo "[OOPS] diffstat was not generated with --stat"
439 false
443 test_debug 'git log --graph --decorate --oneline --all'
445 test_expect_success 'override config option --stat' '
446 git reset --hard c1 &&
447 test_config branch.master.mergeoptions "--stat" &&
448 test_tick &&
449 git merge -n c2 >diffstat.txt &&
450 verify_merge file result.1-5 msg.1-5 &&
451 verify_parents $c1 $c2 &&
452 if grep "^ file | *2 +-$" diffstat.txt
453 then
454 echo "[OOPS] diffstat was generated"
455 false
459 test_debug 'git log --graph --decorate --oneline --all'
461 test_expect_success 'merge c1 with c2 (override --no-commit)' '
462 git reset --hard c1 &&
463 test_config branch.master.mergeoptions "--no-commit" &&
464 test_tick &&
465 git merge --commit c2 &&
466 verify_merge file result.1-5 msg.1-5 &&
467 verify_parents $c1 $c2
470 test_debug 'git log --graph --decorate --oneline --all'
472 test_expect_success 'merge c1 with c2 (override --squash)' '
473 git reset --hard c1 &&
474 test_config branch.master.mergeoptions "--squash" &&
475 test_tick &&
476 git merge --no-squash c2 &&
477 verify_merge file result.1-5 msg.1-5 &&
478 verify_parents $c1 $c2
481 test_debug 'git log --graph --decorate --oneline --all'
483 test_expect_success 'merge c0 with c1 (no-ff)' '
484 git reset --hard c0 &&
485 test_tick &&
486 git merge --no-ff c1 &&
487 verify_merge file result.1 &&
488 verify_parents $c0 $c1
491 test_debug 'git log --graph --decorate --oneline --all'
493 test_expect_success 'merge c0 with c1 (merge.ff=false)' '
494 git reset --hard c0 &&
495 test_config merge.ff "false" &&
496 test_tick &&
497 git merge c1 &&
498 verify_merge file result.1 &&
499 verify_parents $c0 $c1
501 test_debug 'git log --graph --decorate --oneline --all'
503 test_expect_success 'combine branch.master.mergeoptions with merge.ff' '
504 git reset --hard c0 &&
505 test_config branch.master.mergeoptions "--ff" &&
506 test_config merge.ff "false" &&
507 test_tick &&
508 git merge c1 &&
509 verify_merge file result.1 &&
510 verify_parents "$c0"
513 test_expect_success 'tolerate unknown values for merge.ff' '
514 git reset --hard c0 &&
515 test_config merge.ff "something-new" &&
516 test_tick &&
517 git merge c1 2>message &&
518 verify_head "$c1" &&
519 test_must_be_empty message
522 test_expect_success 'combining --squash and --no-ff is refused' '
523 git reset --hard c0 &&
524 test_must_fail git merge --squash --no-ff c1 &&
525 test_must_fail git merge --no-ff --squash c1
528 test_expect_success 'option --ff-only overwrites --no-ff' '
529 git merge --no-ff --ff-only c1 &&
530 test_must_fail git merge --no-ff --ff-only c2
533 test_expect_success 'option --no-ff overrides merge.ff=only config' '
534 git reset --hard c0 &&
535 test_config merge.ff only &&
536 git merge --no-ff c1
539 test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
540 git reset --hard c0 &&
541 test_config branch.master.mergeoptions "--no-ff" &&
542 git merge --ff c1 &&
543 verify_merge file result.1 &&
544 verify_head $c1
547 test_expect_success 'merge log message' '
548 git reset --hard c0 &&
549 git merge --no-log c2 &&
550 git show -s --pretty=format:%b HEAD >msg.act &&
551 test_must_be_empty msg.act &&
553 git reset --hard c0 &&
554 test_config branch.master.mergeoptions "--no-ff" &&
555 git merge --no-log c2 &&
556 git show -s --pretty=format:%b HEAD >msg.act &&
557 test_must_be_empty msg.act &&
559 git merge --log c3 &&
560 git show -s --pretty=format:%b HEAD >msg.act &&
561 test_cmp msg.log msg.act &&
563 git reset --hard HEAD^ &&
564 test_config merge.log "yes" &&
565 git merge c3 &&
566 git show -s --pretty=format:%b HEAD >msg.act &&
567 test_cmp msg.log msg.act
570 test_debug 'git log --graph --decorate --oneline --all'
572 test_expect_success 'merge c1 with c0, c2, c0, and c1' '
573 git reset --hard c1 &&
574 test_tick &&
575 git merge c0 c2 c0 c1 &&
576 verify_merge file result.1-5 &&
577 verify_parents $c1 $c2
580 test_debug 'git log --graph --decorate --oneline --all'
582 test_expect_success 'merge c1 with c0, c2, c0, and c1' '
583 git reset --hard c1 &&
584 test_tick &&
585 git merge c0 c2 c0 c1 &&
586 verify_merge file result.1-5 &&
587 verify_parents $c1 $c2
590 test_debug 'git log --graph --decorate --oneline --all'
592 test_expect_success 'merge c1 with c1 and c2' '
593 git reset --hard c1 &&
594 test_tick &&
595 git merge c1 c2 &&
596 verify_merge file result.1-5 &&
597 verify_parents $c1 $c2
600 test_debug 'git log --graph --decorate --oneline --all'
602 test_expect_success 'merge fast-forward in a dirty tree' '
603 git reset --hard c0 &&
604 mv file file1 &&
605 cat file1 >file &&
606 rm -f file1 &&
607 git merge c2
610 test_debug 'git log --graph --decorate --oneline --all'
612 test_expect_success 'in-index merge' '
613 git reset --hard c0 &&
614 git merge --no-ff -s resolve c1 >out &&
615 test_i18ngrep "Wonderful." out &&
616 verify_parents $c0 $c1
619 test_debug 'git log --graph --decorate --oneline --all'
621 test_expect_success 'refresh the index before merging' '
622 git reset --hard c1 &&
623 cp file file.n && mv -f file.n file &&
624 git merge c3
627 cat >expected.branch <<\EOF
628 Merge branch 'c5-branch' (early part)
630 cat >expected.tag <<\EOF
631 Merge commit 'c5~1'
634 test_expect_success 'merge early part of c2' '
635 git reset --hard c3 &&
636 echo c4 >c4.c &&
637 git add c4.c &&
638 git commit -m c4 &&
639 git tag c4 &&
640 echo c5 >c5.c &&
641 git add c5.c &&
642 git commit -m c5 &&
643 git tag c5 &&
644 git reset --hard c3 &&
645 echo c6 >c6.c &&
646 git add c6.c &&
647 git commit -m c6 &&
648 git tag c6 &&
649 git branch -f c5-branch c5 &&
650 git merge c5-branch~1 &&
651 git show -s --pretty=tformat:%s HEAD >actual.branch &&
652 git reset --keep HEAD^ &&
653 git merge c5~1 &&
654 git show -s --pretty=tformat:%s HEAD >actual.tag &&
655 test_cmp expected.branch actual.branch &&
656 test_cmp expected.tag actual.tag
659 test_debug 'git log --graph --decorate --oneline --all'
661 test_expect_success 'merge --no-ff --no-commit && commit' '
662 git reset --hard c0 &&
663 git merge --no-ff --no-commit c1 &&
664 EDITOR=: git commit &&
665 verify_parents $c0 $c1
668 test_debug 'git log --graph --decorate --oneline --all'
670 test_expect_success 'amending no-ff merge commit' '
671 EDITOR=: git commit --amend &&
672 verify_parents $c0 $c1
675 test_debug 'git log --graph --decorate --oneline --all'
677 cat >editor <<\EOF
678 #!/bin/sh
679 # Add a new message string that was not in the template
681 echo "Merge work done on the side branch c1"
682 echo
683 cat <"$1"
684 ) >"$1.tmp" && mv "$1.tmp" "$1"
685 # strip comments and blank lines from end of message
686 sed -e '/^#/d' < "$1" | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}' > expected
688 chmod 755 editor
690 test_expect_success 'merge --no-ff --edit' '
691 git reset --hard c0 &&
692 EDITOR=./editor git merge --no-ff --edit c1 &&
693 verify_parents $c0 $c1 &&
694 git cat-file commit HEAD >raw &&
695 grep "work done on the side branch" raw &&
696 sed "1,/^$/d" >actual raw &&
697 test_cmp expected actual
700 test_expect_success 'merge annotated/signed tag w/o tracking' '
701 test_when_finished "rm -rf dst; git tag -d anno1" &&
702 git tag -a -m "anno c1" anno1 c1 &&
703 git init dst &&
704 git rev-parse c1 >dst/expect &&
706 # c0 fast-forwards to c1 but because this repository
707 # is not a "downstream" whose refs/tags follows along
708 # tag from the "upstream", this pull defaults to --no-ff
709 cd dst &&
710 git pull .. c0 &&
711 git pull .. anno1 &&
712 git rev-parse HEAD^2 >actual &&
713 test_cmp expect actual
717 test_expect_success 'merge annotated/signed tag w/ tracking' '
718 test_when_finished "rm -rf dst; git tag -d anno1" &&
719 git tag -a -m "anno c1" anno1 c1 &&
720 git init dst &&
721 git rev-parse c1 >dst/expect &&
723 # c0 fast-forwards to c1 and because this repository
724 # is a "downstream" whose refs/tags follows along
725 # tag from the "upstream", this pull defaults to --ff
726 cd dst &&
727 git remote add origin .. &&
728 git pull origin c0 &&
729 git fetch origin &&
730 git merge anno1 &&
731 git rev-parse HEAD >actual &&
732 test_cmp expect actual
736 test_expect_success GPG 'merge --ff-only tag' '
737 git reset --hard c0 &&
738 git commit --allow-empty -m "A newer commit" &&
739 git tag -s -m "A newer commit" signed &&
740 git reset --hard c0 &&
742 git merge --ff-only signed &&
743 git rev-parse signed^0 >expect &&
744 git rev-parse HEAD >actual &&
745 test_cmp expect actual
748 test_expect_success GPG 'merge --no-edit tag should skip editor' '
749 git reset --hard c0 &&
750 git commit --allow-empty -m "A newer commit" &&
751 git tag -f -s -m "A newer commit" signed &&
752 git reset --hard c0 &&
754 EDITOR=false git merge --no-edit --no-ff signed &&
755 git rev-parse signed^0 >expect &&
756 git rev-parse HEAD^2 >actual &&
757 test_cmp expect actual
760 test_expect_success 'set up mod-256 conflict scenario' '
761 # 256 near-identical stanzas...
762 for i in $(test_seq 1 256); do
763 for j in 1 2 3 4 5; do
764 echo $i-$j
765 done
766 done >file &&
767 git add file &&
768 git commit -m base &&
770 # one side changes the first line of each to "master"
771 sed s/-1/-master/ <file >tmp &&
772 mv tmp file &&
773 git commit -am master &&
775 # and the other to "side"; merging the two will
776 # yield 256 separate conflicts
777 git checkout -b side HEAD^ &&
778 sed s/-1/-side/ <file >tmp &&
779 mv tmp file &&
780 git commit -am side
783 test_expect_success 'merge detects mod-256 conflicts (recursive)' '
784 git reset --hard &&
785 test_must_fail git merge -s recursive master
788 test_expect_success 'merge detects mod-256 conflicts (resolve)' '
789 git reset --hard &&
790 test_must_fail git merge -s resolve master
793 test_expect_success 'merge nothing into void' '
794 git init void &&
796 cd void &&
797 git remote add up .. &&
798 git fetch up &&
799 test_must_fail git merge FETCH_HEAD
803 test_expect_success 'merge can be completed with --continue' '
804 git reset --hard c0 &&
805 git merge --no-ff --no-commit c1 &&
806 git merge --continue &&
807 verify_parents $c0 $c1
810 write_script .git/FAKE_EDITOR <<EOF
811 # kill -TERM command added below.
814 test_expect_success EXECKEEPSPID 'killed merge can be completed with --continue' '
815 git reset --hard c0 &&
816 ! "$SHELL_PATH" -c '\''
817 echo kill -TERM $$ >> .git/FAKE_EDITOR
818 GIT_EDITOR=.git/FAKE_EDITOR
819 export GIT_EDITOR
820 exec git merge --no-ff --edit c1'\'' &&
821 git merge --continue &&
822 verify_parents $c0 $c1
825 test_done