Merge branch 'jc/add-2.0-u-A-sans-pathspec' (early part)
[git/mjg.git] / t / t3031-merge-criscross.sh
blob7f41607c569866e493e162e5078ff741bd520d09
1 #!/bin/sh
3 test_description='merge-recursive backend test'
5 . ./test-lib.sh
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
25 # initialize
26 test_expect_success 'setup repo with criss-cross history' '
27 mkdir data &&
29 # create a bunch of files
30 n=1 &&
31 while test $n -le 10
33 echo $n > data/$n &&
34 n=$(($n+1)) ||
35 break
36 done &&
38 # check them in
39 git add data &&
40 git commit -m A &&
41 git branch A &&
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 &&
49 # with a branch off of it
50 git branch D &&
52 # put some commits on D
53 git checkout D &&
54 echo testD > data/testD &&
55 git add data &&
56 git commit -m D &&
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 &&
65 # with a branch off of it
66 git branch E &&
68 # put a commit on E
69 git checkout E &&
70 echo testE > data/testE &&
71 git add data &&
72 git commit -m E &&
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 &&
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
91 test_expect_success 'recursive merge between F and G, causes segfault' '
92 git merge F
95 test_done