1#!/bin/sh
   2test_description='merging with submodules'
   4. ./test-lib.sh
   6#
   8# history
   9#
  10#        a --- c
  11#      /   \ /
  12# root      X
  13#      \   / \
  14#        b --- d
  15#
  16test_expect_success setup '
  18        mkdir sub &&
  20        (cd sub &&
  21         git init &&
  22         echo original > file &&
  23         git add file &&
  24         test_tick &&
  25         git commit -m sub-root) &&
  26        git add sub &&
  27        test_tick &&
  28        git commit -m root &&
  29        git checkout -b a master &&
  31        (cd sub &&
  32         echo A > file &&
  33         git add file &&
  34         test_tick &&
  35         git commit -m sub-a) &&
  36        git add sub &&
  37        test_tick &&
  38        git commit -m a &&
  39        git checkout -b b master &&
  41        (cd sub &&
  42         echo B > file &&
  43         git add file &&
  44         test_tick &&
  45         git commit -m sub-b) &&
  46        git add sub &&
  47        test_tick &&
  48        git commit -m b
  49        git checkout -b c a &&
  51        git merge -s ours b &&
  52        git checkout -b d b &&
  54        git merge -s ours a
  55'
  56test_expect_success 'merging with modify/modify conflict' '
  58        git checkout -b test1 a &&
  60        test_must_fail git merge b &&
  61        test -f .git/MERGE_MSG &&
  62        git diff &&
  63        test -n "$(git ls-files -u)"
  64'
  65test_expect_success 'merging with a modify/modify conflict between merge bases' '
  67        git reset --hard HEAD &&
  69        git checkout -b test2 c &&
  70        git merge d
  71'
  73test_done