t7603: add new testcases to ensure builtin-commit uses reduce_heads()
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Miklos Vajna committed
Sep 10, 2008 at 22:10 UTC
7a172b0dcb9d8ac2311a5c3f674f711476872e71
1 file changed
+53
t/t7603-merge-reduce-heads.sh
+53
@@ -60,4 +60,57 @@ test_expect_success 'merge c1 with c2, c3, c4, c5' '
60
test -f c5.c
61
'
62
63
+test_expect_success 'setup' '
64
+ for i in A B C D E
65
+ do
66
+ echo $i > $i.c &&
67
+ git add $i.c &&
68
+ git commit -m $i &&
69
+ git tag $i
70
+ done &&
71
+ git reset --hard A &&
72
+ for i in F G H I
73
+ do
74
+ echo $i > $i.c &&
75
+ git add $i.c &&
76
+ git commit -m $i &&
77
+ git tag $i
78
+ done
79
+'
80
+
81
+test_expect_success 'merge E and I' '
82
+ git reset --hard A &&
83
+ git merge E I
84
+'
85
+
86
+test_expect_success 'verify merge result' '
87
+ test $(git rev-parse HEAD^1) = $(git rev-parse E) &&
88
+ test $(git rev-parse HEAD^2) = $(git rev-parse I)
89
+'
90
+
91
+test_expect_success 'add conflicts' '
92
+ git reset --hard E &&
93
+ echo foo > file.c &&
94
+ git add file.c &&
95
+ git commit -m E2 &&
96
+ git tag E2 &&
97
+ git reset --hard I &&
98
+ echo bar >file.c &&
99
+ git add file.c &&
100
+ git commit -m I2 &&
101
+ git tag I2
102
+'
103
+
104
+test_expect_success 'merge E2 and I2, causing a conflict and resolve it' '
105
+ git reset --hard A &&
106
+ test_must_fail git merge E2 I2 &&
107
+ echo baz > file.c &&
108
+ git add file.c &&
109
+ git commit -m "resolve conflict"
110
+'
111
+
112
+test_expect_success 'verify merge result' '
113
+ test $(git rev-parse HEAD^1) = $(git rev-parse E2) &&
114
+ test $(git rev-parse HEAD^2) = $(git rev-parse I2)
115
+'
116
test_done