t / t6021-merge-criss-cross.shon commit Merge branch 'oh/fix-config-default-user-name-section' into maint-2.3 (1add9ae)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Fredrik Kuivinen
   4#
   5
   6# See http://marc.info/?l=git&m=111463358500362&w=2 for a
   7# nice description of what this is about.
   8
   9
  10test_description='Test criss-cross merge'
  11. ./test-lib.sh
  12
  13test_expect_success 'prepare repository' \
  14'echo "1
  152
  163
  174
  185
  196
  207
  218
  229" > file &&
  23git add file &&
  24git commit -m "Initial commit" file &&
  25git branch A &&
  26git branch B &&
  27git checkout A &&
  28echo "1
  292
  303
  314
  325
  336
  347
  358 changed in B8, branch A
  369" > file &&
  37git commit -m "B8" file &&
  38git checkout B &&
  39echo "1
  402
  413 changed in C3, branch B
  424
  435
  446
  457
  468
  479
  48" > file &&
  49git commit -m "C3" file &&
  50git branch C3 &&
  51git merge "pre E3 merge" B A &&
  52echo "1
  532
  543 changed in E3, branch B. New file size
  554
  565
  576
  587
  598 changed in B8, branch A
  609
  61" > file &&
  62git commit -m "E3" file &&
  63git checkout A &&
  64git merge "pre D8 merge" A C3 &&
  65echo "1
  662
  673 changed in C3, branch B
  684
  695
  706
  717
  728 changed in D8, branch A. New file size 2
  739" > file &&
  74git commit -m D8 file'
  75
  76test_expect_success 'Criss-cross merge' 'git merge "final merge" A B'
  77
  78cat > file-expect <<EOF
  791
  802
  813 changed in E3, branch B. New file size
  824
  835
  846
  857
  868 changed in D8, branch A. New file size 2
  879
  88EOF
  89
  90test_expect_success 'Criss-cross merge result' 'cmp file file-expect'
  91
  92test_expect_success 'Criss-cross merge fails (-s resolve)' \
  93'git reset --hard A^ &&
  94test_must_fail git merge -s resolve -m "final merge" B'
  95
  96test_done