aboutsummaryrefslogtreecommitdiff
path: root/t/t7602-merge-octopus-many.sh
blob: 2746169514f9bd1629f05eed8f9ff2fcfdba8cb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh

test_description='git merge

Testing octopus merge with more than 25 refs.'

. ./test-lib.sh

test_expect_success 'setup' '
	echo c0 > c0.c &&
	git add c0.c &&
	git commit -m c0 &&
	git tag c0 &&
	i=1 &&
	while test $i -le 30
	do
		git reset --hard c0 &&
		echo c$i > c$i.c &&
		git add c$i.c &&
		git commit -m c$i &&
		git tag c$i &&
		i=`expr $i + 1` || return 1
	done
'

test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
	git reset --hard c1 &&
	i=2 &&
	refs="" &&
	while test $i -le 30
	do
		refs="$refs c$i"
		i=`expr $i + 1`
	done
	git merge $refs &&
	test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
	i=1 &&
	while test $i -le 30
	do
		test "$(git rev-parse c$i)" = "$(git rev-parse HEAD^$i)" &&
		i=`expr $i + 1` || return 1
	done &&
	git diff --exit-code &&
	i=1 &&
	while test $i -le 30
	do
		test -f c$i.c &&
		i=`expr $i + 1` || return 1
	done
'

cat >expected <<\EOF
Trying simple merge with c2
Trying simple merge with c3
Trying simple merge with c4
Merge made by octopus.
 c2.c |    1 +
 c3.c |    1 +
 c4.c |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 c2.c
 create mode 100644 c3.c
 create mode 100644 c4.c
EOF

test_expect_success 'merge output uses pretty names' '
	git reset --hard c1 &&
	git merge c2 c3 c4 >actual &&
	test_cmp actual expected
'

cat >expected <<\EOF
Already up-to-date with c4
Trying simple merge with c5
Merge made by octopus.
 c5.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 c5.c
EOF

test_expect_success 'merge up-to-date output uses pretty names' '
	git merge c4 c5 >actual &&
	test_cmp actual expected
'

cat >expected <<\EOF
Fast-forwarding to: c1
Trying simple merge with c2
Merge made by octopus.
 c1.c |    1 +
 c2.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 c1.c
 create mode 100644 c2.c
EOF

test_expect_success 'merge fast-forward output uses pretty names' '
	git reset --hard c0 &&
	git merge c1 c2 >actual &&
	test_cmp actual expected
'

test_done