]> git.ipfire.org Git - thirdparty/git.git/blob - t/t7602-merge-octopus-many.sh
Merge branch 'bl/pretty-shorthand-config-fix'
[thirdparty/git.git] / t / t7602-merge-octopus-many.sh
1 #!/bin/sh
2
3 test_description='git merge
4
5 Testing octopus merge with more than 25 refs.'
6
7 TEST_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
9
10 test_expect_success 'setup' '
11 echo c0 > c0.c &&
12 git add c0.c &&
13 git commit -m c0 &&
14 git tag c0 &&
15 i=1 &&
16 while test $i -le 30
17 do
18 git reset --hard c0 &&
19 echo c$i > c$i.c &&
20 git add c$i.c &&
21 git commit -m c$i &&
22 git tag c$i &&
23 i=$(expr $i + 1) || return 1
24 done
25 '
26
27 test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
28 git reset --hard c1 &&
29 i=2 &&
30 refs="" &&
31 while test $i -le 30
32 do
33 refs="$refs c$i" &&
34 i=$(expr $i + 1) || return 1
35 done &&
36 git merge $refs &&
37 test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
38 i=1 &&
39 while test $i -le 30
40 do
41 test "$(git rev-parse c$i)" = "$(git rev-parse HEAD^$i)" &&
42 i=$(expr $i + 1) || return 1
43 done &&
44 git diff --exit-code &&
45 i=1 &&
46 while test $i -le 30
47 do
48 test -f c$i.c &&
49 i=$(expr $i + 1) || return 1
50 done
51 '
52
53 cat >expected <<\EOF
54 Trying simple merge with c2
55 Trying simple merge with c3
56 Trying simple merge with c4
57 Merge made by the 'octopus' strategy.
58 c2.c | 1 +
59 c3.c | 1 +
60 c4.c | 1 +
61 3 files changed, 3 insertions(+)
62 create mode 100644 c2.c
63 create mode 100644 c3.c
64 create mode 100644 c4.c
65 EOF
66
67 test_expect_success 'merge output uses pretty names' '
68 git reset --hard c1 &&
69 git merge c2 c3 c4 >actual &&
70 test_cmp expected actual
71 '
72
73 cat >expected <<\EOF
74 Merge made by the 'recursive' strategy.
75 c5.c | 1 +
76 1 file changed, 1 insertion(+)
77 create mode 100644 c5.c
78 EOF
79
80 test_expect_success 'merge reduces irrelevant remote heads' '
81 if test "$GIT_TEST_MERGE_ALGORITHM" = ort
82 then
83 mv expected expected.tmp &&
84 sed s/recursive/ort/ expected.tmp >expected &&
85 rm expected.tmp
86 fi &&
87 GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
88 test_cmp expected actual
89 '
90
91 cat >expected <<\EOF
92 Fast-forwarding to: c1
93 Trying simple merge with c2
94 Merge made by the 'octopus' strategy.
95 c1.c | 1 +
96 c2.c | 1 +
97 2 files changed, 2 insertions(+)
98 create mode 100644 c1.c
99 create mode 100644 c2.c
100 EOF
101
102 test_expect_success 'merge fast-forward output uses pretty names' '
103 git reset --hard c0 &&
104 git merge c1 c2 >actual &&
105 test_cmp expected actual
106 '
107
108 test_done