Add new test case to ensure git-merge reduces octopus parents when possible
The old shell version used show-branch --independent to filter for the ones that cannot be reached from any other reference. The new C version uses reduce_heads() from commit.c for this, so add test to ensure it works as expected. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Miklos Vajna committed
Jun 27, 2008 at 18:22 UTC
f4022fa33f1b0a63029d1bc3748f01f720151218
1 file changed
+63
t/t7603-merge-reduce-heads.sh
new
+63
@@ -0,0 +1,63 @@
1
+#!/bin/sh
2
+
3
+test_description='git-merge
4
+
5
+Testing octopus merge when reducing parents to independent branches.'
6
+
7
+. ./test-lib.sh
8
+
9
+# 0 - 1
10
+# \ 2
11
+# \ 3
12
+# \ 4 - 5
13
+#
14
+# So 1, 2, 3 and 5 should be kept, 4 should be avoided.
15
+
16
+test_expect_success 'setup' '
17
+ echo c0 > c0.c &&
18
+ git add c0.c &&
19
+ git commit -m c0 &&
20
+ git tag c0 &&
21
+ echo c1 > c1.c &&
22
+ git add c1.c &&
23
+ git commit -m c1 &&
24
+ git tag c1 &&
25
+ git reset --hard c0 &&
26
+ echo c2 > c2.c &&
27
+ git add c2.c &&
28
+ git commit -m c2 &&
29
+ git tag c2 &&
30
+ git reset --hard c0 &&
31
+ echo c3 > c3.c &&
32
+ git add c3.c &&
33
+ git commit -m c3 &&
34
+ git tag c3 &&
35
+ git reset --hard c0 &&
36
+ echo c4 > c4.c &&
37
+ git add c4.c &&
38
+ git commit -m c4 &&
39
+ git tag c4 &&
40
+ echo c5 > c5.c &&
41
+ git add c5.c &&
42
+ git commit -m c5 &&
43
+ git tag c5
44
+'
45
+
46
+test_expect_success 'merge c1 with c2, c3, c4, c5' '
47
+ git reset --hard c1 &&
48
+ git merge c2 c3 c4 c5 &&
49
+ test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" &&
50
+ test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" &&
51
+ test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" &&
52
+ test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" &&
53
+ test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" &&
54
+ git diff --exit-code &&
55
+ test -f c0.c &&
56
+ test -f c1.c &&
57
+ test -f c2.c &&
58
+ test -f c3.c &&
59
+ test -f c4.c &&
60
+ test -f c5.c
61
+'
62
+
63
+test_done