]>
Commit | Line | Data |
---|---|---|
458152cc JC |
1 | #!/bin/sh |
2 | ||
3 | test_description='git log --graph of skewed merges' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
d784d978 DL |
7 | check_graph () { |
8 | cat >expect && | |
9 | git log --graph --pretty=tformat:%s "$@" >actual.raw && | |
10 | sed "s/ *$//" actual.raw >actual && | |
11 | test_cmp expect actual | |
12 | } | |
13 | ||
458152cc | 14 | test_expect_success 'log --graph with merge fusing with its left and right neighbors' ' |
d784d978 DL |
15 | git checkout --orphan _p && |
16 | test_commit A && | |
17 | test_commit B && | |
18 | git checkout -b _q @^ && test_commit C && | |
19 | git checkout -b _r @^ && test_commit D && | |
20 | git checkout _p && git merge --no-ff _q _r -m E && | |
21 | git checkout _r && test_commit F && | |
22 | git checkout _p && git merge --no-ff _r -m G && | |
23 | git checkout @^^ && git merge --no-ff _p -m H && | |
24 | ||
25 | check_graph <<-\EOF | |
458152cc JC |
26 | * H |
27 | |\ | |
28 | | * G | |
29 | | |\ | |
30 | | | * F | |
92beecc1 JC |
31 | | * | E |
32 | |/|\| | |
458152cc JC |
33 | | | * D |
34 | | * | C | |
35 | | |/ | |
479db18b | 36 | * / B |
458152cc JC |
37 | |/ |
38 | * A | |
39 | EOF | |
458152cc JC |
40 | ' |
41 | ||
0f0f389f | 42 | test_expect_success 'log --graph with left-skewed merge' ' |
d784d978 DL |
43 | git checkout --orphan 0_p && test_commit 0_A && |
44 | git checkout -b 0_q 0_p && test_commit 0_B && | |
45 | git checkout -b 0_r 0_p && | |
46 | test_commit 0_C && | |
47 | test_commit 0_D && | |
48 | git checkout -b 0_s 0_p && test_commit 0_E && | |
49 | git checkout -b 0_t 0_p && git merge --no-ff 0_r^ 0_s -m 0_F && | |
50 | git checkout 0_p && git merge --no-ff 0_s -m 0_G && | |
51 | git checkout @^ && git merge --no-ff 0_q 0_r 0_t 0_p -m 0_H && | |
52 | ||
53 | check_graph <<-\EOF | |
0f0f389f JC |
54 | *-----. 0_H |
55 | |\ \ \ \ | |
56 | | | | | * 0_G | |
57 | | |_|_|/| | |
58 | |/| | | | | |
92beecc1 JC |
59 | | | | * | 0_F |
60 | | |_|/|\| | |
61 | |/| | | | | |
0f0f389f JC |
62 | | | | | * 0_E |
63 | | |_|_|/ | |
64 | |/| | | | |
65 | | | * | 0_D | |
66 | | | |/ | |
67 | | | * 0_C | |
68 | | |/ | |
69 | |/| | |
70 | | * 0_B | |
71 | |/ | |
72 | * 0_A | |
73 | EOF | |
0f0f389f JC |
74 | ' |
75 | ||
d62893ec | 76 | test_expect_success 'log --graph with nested left-skewed merge' ' |
d784d978 DL |
77 | git checkout --orphan 1_p && |
78 | test_commit 1_A && | |
79 | test_commit 1_B && | |
80 | test_commit 1_C && | |
81 | git checkout -b 1_q @^ && test_commit 1_D && | |
82 | git checkout 1_p && git merge --no-ff 1_q -m 1_E && | |
83 | git checkout -b 1_r @~3 && test_commit 1_F && | |
84 | git checkout 1_p && git merge --no-ff 1_r -m 1_G && | |
85 | git checkout @^^ && git merge --no-ff 1_p -m 1_H && | |
86 | ||
87 | check_graph <<-\EOF | |
d62893ec JC |
88 | * 1_H |
89 | |\ | |
90 | | * 1_G | |
91 | | |\ | |
92 | | | * 1_F | |
93 | | * | 1_E | |
94 | |/| | | |
95 | | * | 1_D | |
96 | * | | 1_C | |
97 | |/ / | |
479db18b | 98 | * / 1_B |
d62893ec JC |
99 | |/ |
100 | * 1_A | |
101 | EOF | |
d62893ec JC |
102 | ' |
103 | ||
104 | test_expect_success 'log --graph with nested left-skewed merge following normal merge' ' | |
d784d978 DL |
105 | git checkout --orphan 2_p && |
106 | test_commit 2_A && | |
107 | test_commit 2_B && | |
108 | test_commit 2_C && | |
109 | git checkout -b 2_q @^^ && | |
110 | test_commit 2_D && | |
111 | test_commit 2_E && | |
112 | git checkout -b 2_r @^ && test_commit 2_F && | |
113 | git checkout 2_q && | |
114 | git merge --no-ff 2_r -m 2_G && | |
115 | git merge --no-ff 2_p^ -m 2_H && | |
116 | git checkout -b 2_s @^^ && git merge --no-ff 2_q -m 2_J && | |
117 | git checkout 2_p && git merge --no-ff 2_s -m 2_K && | |
118 | ||
119 | check_graph <<-\EOF | |
d62893ec JC |
120 | * 2_K |
121 | |\ | |
122 | | * 2_J | |
123 | | |\ | |
124 | | | * 2_H | |
125 | | | |\ | |
126 | | | * | 2_G | |
127 | | |/| | | |
128 | | | * | 2_F | |
129 | | * | | 2_E | |
130 | | |/ / | |
131 | | * | 2_D | |
132 | * | | 2_C | |
133 | | |/ | |
134 | |/| | |
135 | * | 2_B | |
136 | |/ | |
137 | * 2_A | |
138 | EOF | |
d62893ec JC |
139 | ' |
140 | ||
141 | test_expect_success 'log --graph with nested right-skewed merge following left-skewed merge' ' | |
d784d978 DL |
142 | git checkout --orphan 3_p && |
143 | test_commit 3_A && | |
144 | git checkout -b 3_q && | |
145 | test_commit 3_B && | |
146 | test_commit 3_C && | |
147 | git checkout -b 3_r @^ && | |
148 | test_commit 3_D && | |
149 | git checkout 3_q && git merge --no-ff 3_r -m 3_E && | |
150 | git checkout 3_p && git merge --no-ff 3_q -m 3_F && | |
151 | git checkout 3_r && test_commit 3_G && | |
152 | git checkout 3_p && git merge --no-ff 3_r -m 3_H && | |
153 | git checkout @^^ && git merge --no-ff 3_p -m 3_J && | |
154 | ||
155 | check_graph <<-\EOF | |
d62893ec JC |
156 | * 3_J |
157 | |\ | |
158 | | * 3_H | |
159 | | |\ | |
160 | | | * 3_G | |
161 | | * | 3_F | |
162 | |/| | | |
92beecc1 JC |
163 | | * | 3_E |
164 | | |\| | |
d62893ec JC |
165 | | | * 3_D |
166 | | * | 3_C | |
167 | | |/ | |
168 | | * 3_B | |
169 | |/ | |
170 | * 3_A | |
171 | EOF | |
d62893ec JC |
172 | ' |
173 | ||
174 | test_expect_success 'log --graph with right-skewed merge following a left-skewed one' ' | |
d784d978 DL |
175 | git checkout --orphan 4_p && |
176 | test_commit 4_A && | |
177 | test_commit 4_B && | |
178 | test_commit 4_C && | |
179 | git checkout -b 4_q @^^ && test_commit 4_D && | |
180 | git checkout -b 4_r 4_p^ && git merge --no-ff 4_q -m 4_E && | |
181 | git checkout -b 4_s 4_p^^ && | |
182 | git merge --no-ff 4_r -m 4_F && | |
183 | git merge --no-ff 4_p -m 4_G && | |
184 | git checkout @^^ && git merge --no-ff 4_s -m 4_H && | |
185 | ||
186 | check_graph --date-order <<-\EOF | |
d62893ec JC |
187 | * 4_H |
188 | |\ | |
189 | | * 4_G | |
190 | | |\ | |
191 | | * | 4_F | |
192 | |/| | | |
193 | | * | 4_E | |
194 | | |\ \ | |
195 | | | * | 4_D | |
196 | | |/ / | |
197 | |/| | | |
198 | | | * 4_C | |
199 | | |/ | |
200 | | * 4_B | |
201 | |/ | |
202 | * 4_A | |
203 | EOF | |
d62893ec JC |
204 | ' |
205 | ||
92beecc1 | 206 | test_expect_success 'log --graph with octopus merge with column joining its penultimate parent' ' |
d784d978 DL |
207 | git checkout --orphan 5_p && |
208 | test_commit 5_A && | |
209 | git branch 5_q && | |
210 | git branch 5_r && | |
211 | test_commit 5_B && | |
212 | git checkout 5_q && test_commit 5_C && | |
213 | git checkout 5_r && test_commit 5_D && | |
214 | git checkout 5_p && | |
215 | git merge --no-ff 5_q 5_r -m 5_E && | |
216 | git checkout 5_q && test_commit 5_F && | |
217 | git checkout -b 5_s 5_p^ && | |
218 | git merge --no-ff 5_p 5_q -m 5_G && | |
219 | git checkout 5_r && | |
220 | git merge --no-ff 5_s -m 5_H && | |
221 | ||
222 | check_graph <<-\EOF | |
92beecc1 JC |
223 | * 5_H |
224 | |\ | |
225 | | *-. 5_G | |
226 | | |\ \ | |
227 | | | | * 5_F | |
228 | | | * | 5_E | |
229 | | |/|\ \ | |
230 | | |_|/ / | |
231 | |/| | / | |
232 | | | |/ | |
233 | * | | 5_D | |
234 | | | * 5_C | |
235 | | |/ | |
236 | |/| | |
237 | | * 5_B | |
238 | |/ | |
239 | * 5_A | |
240 | EOF | |
92beecc1 JC |
241 | ' |
242 | ||
458152cc | 243 | test_done |