Merge branch 'es/worktree-repair-copied' into cw/worktrees-relative
[git/gitster.git] / t / t6431-merge-criscross.sh
blob3fe14cd73e895fde51b4f711865553e7a142a2ea
1 #!/bin/sh
3 test_description='merge-recursive backend test'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 # A <- create some files
9 # / \
10 # B C <- cause rename/delete conflicts between B and C
11 # / \
12 # |\ /|
13 # | D E |
14 # | \ / |
15 # | X |
16 # | / \ |
17 # | / \ |
18 # |/ \|
19 # F G <- merge E into B, D into C
20 # \ /
21 # \ /
22 # \ /
23 # H <- recursive merge crashes
26 # initialize
27 test_expect_success 'setup repo with criss-cross history' '
28 mkdir data &&
30 # create a bunch of files
31 n=1 &&
32 while test $n -le 10
34 echo $n > data/$n &&
35 n=$(($n+1)) ||
36 return 1
37 done &&
39 # check them in
40 git add data &&
41 git commit -m A &&
42 git branch A &&
44 # a file in one branch
45 git checkout -b B A &&
46 git rm data/9 &&
47 git add data &&
48 git commit -m B &&
50 # with a branch off of it
51 git branch D &&
53 # put some commits on D
54 git checkout D &&
55 echo testD > data/testD &&
56 git add data &&
57 git commit -m D &&
59 # back up to the top, create another branch and cause
60 # a rename conflict with the file we deleted earlier
61 git checkout -b C A &&
62 git mv data/9 data/new-9 &&
63 git add data &&
64 git commit -m C &&
66 # with a branch off of it
67 git branch E &&
69 # put a commit on E
70 git checkout E &&
71 echo testE > data/testE &&
72 git add data &&
73 git commit -m E &&
75 # now, merge E into B
76 git checkout B &&
77 test_must_fail git merge E &&
78 # force-resolve
79 git add data &&
80 git commit -m F &&
81 git branch F &&
83 # and merge D into C
84 git checkout C &&
85 test_must_fail git merge D &&
86 # force-resolve
87 git add data &&
88 git commit -m G &&
89 git branch G
92 test_expect_success 'recursive merge between F and G does not cause segfault' '
93 git merge F
96 test_done