631
test_cmp merged file
632
'
633
634
+test_expect_success 'checkout --conflict=diff3 --no-conflict does not merge' '
635
+ setup_conflicting_index &&
636
+ echo "none of the above" >expect &&
637
+ cat expect >fild &&
638
+ cat expect >file &&
639
+ test_must_fail git checkout --conflict=diff3 --no-conflict -- fild file 2>err &&
640
+ test_cmp expect file &&
641
+ test_cmp expect fild &&
642
+ echo "error: path ${SQ}file${SQ} is unmerged" >expect &&
643
+ test_cmp expect err
644
+'
645
+
646
+test_expect_success 'checkout --conflict=diff3 --no-merge does not merge' '
647
+ setup_conflicting_index &&
648
+ echo "none of the above" >expect &&
649
+ cat expect >fild &&
650
+ cat expect >file &&
651
+ test_must_fail git checkout --conflict=diff3 --no-merge -- fild file 2>err &&
652
+ test_cmp expect file &&
653
+ test_cmp expect fild &&
654
+ echo "error: path ${SQ}file${SQ} is unmerged" >expect &&
655
+ test_cmp expect err
656
+'
657
+
658
+test_expect_success 'checkout --no-merge --conflict=diff3 does merge' '
659
+ setup_conflicting_index &&
660
+ echo "none of the above" >fild &&
661
+ echo "none of the above" >file &&
662
+ git checkout --no-merge --conflict=diff3 -- fild file &&
663
+ echo "ourside" >expect &&
664
+ test_cmp expect fild &&
665
+ cat >expect <<-\EOF &&
666
+ <<<<<<< ours
667
+ ourside
668
+ ||||||| base
669
+ original
670
+ =======
671
+ theirside
672
+ >>>>>>> theirs
673
+ EOF
674
+ test_cmp expect file
675
+'
676
+
677
+test_expect_success 'checkout --merge --conflict=diff3 --no-conflict does merge' '
678
+ setup_conflicting_index &&
679
+ echo "none of the above" >fild &&
680
+ echo "none of the above" >file &&
681
+ git checkout --merge --conflict=diff3 --no-conflict -- fild file &&
682
+ echo "ourside" >expect &&
683
+ test_cmp expect fild &&
684
+ cat >expect <<-\EOF &&
685
+ <<<<<<< ours
686
+ ourside
687
+ =======
688
+ theirside
689
+ >>>>>>> theirs
690
+ EOF
691
+ test_cmp expect file
692
+'
693
+
694
test_expect_success 'checkout with invalid conflict style' '
695
test_must_fail git checkout --conflict=bad 2>actual -- file &&
696
echo "error: unknown conflict style ${SQ}bad${SQ}" >expect &&