t / t3031-merge-criscross.shon commit check_filename: tighten dwim-wildcard ambiguity (df714f8)
   1#!/bin/sh
   2
   3test_description='merge-recursive backend test'
   4
   5. ./test-lib.sh
   6
   7#         A      <- create some files
   8#        / \
   9#       B   C    <- cause rename/delete conflicts between B and C
  10#      /     \
  11#     |\     /|
  12#     | D   E |
  13#     |  \ /  |
  14#     |   X   |
  15#     |  / \  |
  16#     | /   \ |
  17#     |/     \|
  18#     F       G  <- merge E into B, D into C
  19#      \     /
  20#       \   /
  21#        \ /
  22#         H      <- recursive merge crashes
  23#
  24
  25# initialize
  26test_expect_success 'setup repo with criss-cross history' '
  27        mkdir data &&
  28
  29        # create a bunch of files
  30        n=1 &&
  31        while test $n -le 10
  32        do
  33                echo $n > data/$n &&
  34                n=$(($n+1)) ||
  35                return 1
  36        done &&
  37
  38        # check them in
  39        git add data &&
  40        git commit -m A &&
  41        git branch A &&
  42
  43        # a file in one branch
  44        git checkout -b B A &&
  45        git rm data/9 &&
  46        git add data &&
  47        git commit -m B &&
  48
  49        # with a branch off of it
  50        git branch D &&
  51
  52        # put some commits on D
  53        git checkout D &&
  54        echo testD > data/testD &&
  55        git add data &&
  56        git commit -m D &&
  57
  58        # back up to the top, create another branch and cause
  59        # a rename conflict with the file we deleted earlier
  60        git checkout -b C A &&
  61        git mv data/9 data/new-9 &&
  62        git add data &&
  63        git commit -m C &&
  64
  65        # with a branch off of it
  66        git branch E &&
  67
  68        # put a commit on E
  69        git checkout E &&
  70        echo testE > data/testE &&
  71        git add data &&
  72        git commit -m E &&
  73
  74        # now, merge E into B
  75        git checkout B &&
  76        test_must_fail git merge E &&
  77        # force-resolve
  78        git add data &&
  79        git commit -m F &&
  80        git branch F &&
  81
  82        # and merge D into C
  83        git checkout C &&
  84        test_must_fail git merge D &&
  85        # force-resolve
  86        git add data &&
  87        git commit -m G &&
  88        git branch G
  89'
  90
  91test_expect_success 'recursive merge between F and G, causes segfault' '
  92        git merge F
  93'
  94
  95test_done