]> git.ipfire.org Git - thirdparty/git.git/blob - t/t6431-merge-criscross.sh
Sync with Git 2.45.1
[thirdparty/git.git] / t / t6431-merge-criscross.sh
1 #!/bin/sh
2
3 test_description='merge-recursive backend test'
4
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
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
24 #
25
26 # initialize
27 test_expect_success 'setup repo with criss-cross history' '
28 mkdir data &&
29
30 # create a bunch of files
31 n=1 &&
32 while test $n -le 10
33 do
34 echo $n > data/$n &&
35 n=$(($n+1)) ||
36 return 1
37 done &&
38
39 # check them in
40 git add data &&
41 git commit -m A &&
42 git branch A &&
43
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 &&
49
50 # with a branch off of it
51 git branch D &&
52
53 # put some commits on D
54 git checkout D &&
55 echo testD > data/testD &&
56 git add data &&
57 git commit -m D &&
58
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 &&
65
66 # with a branch off of it
67 git branch E &&
68
69 # put a commit on E
70 git checkout E &&
71 echo testE > data/testE &&
72 git add data &&
73 git commit -m E &&
74
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 &&
82
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
90 '
91
92 test_expect_success 'recursive merge between F and G does not cause segfault' '
93 git merge F
94 '
95
96 test_done