Merge branch 'es/worktree-repair-copied' into cw/worktrees-relative
[git/gitster.git] / t / t7602-merge-octopus-many.sh
blob3669d33bd5a15fc19fbfd2cbea14507c8e273642
1 #!/bin/sh
3 test_description='git merge
5 Testing octopus merge with more than 25 refs.'
7 TEST_PASSES_SANITIZE_LEAK=true
8 . ./test-lib.sh
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
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
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
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
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
48 test -f c$i.c &&
49 i=$(expr $i + 1) || return 1
50 done
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
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
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
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
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
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
108 test_done