]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | test_description='git log --graph of skewed left octopus merge.' | |
4 | ||
5 | . ./test-lib.sh | |
6 | . "$TEST_DIRECTORY"/lib-log-graph.sh | |
7 | ||
8 | test_cmp_graph () { | |
9 | cat >expect && | |
10 | lib_test_cmp_graph --color=never --date-order --format=%s "$@" | |
11 | } | |
12 | ||
13 | test_cmp_colored_graph () { | |
14 | lib_test_cmp_colored_graph --date-order --format=%s "$@" | |
15 | } | |
16 | ||
17 | test_expect_success 'set up merge history' ' | |
18 | test_commit initial && | |
19 | for i in 1 2 3 4 ; do | |
20 | git checkout master -b $i || return $? | |
21 | # Make tag name different from branch name, to avoid | |
22 | # ambiguity error when calling checkout. | |
23 | test_commit $i $i $i tag$i || return $? | |
24 | done && | |
25 | git checkout 1 -b merge && | |
26 | test_merge octopus-merge 1 2 3 4 && | |
27 | test_commit after-merge && | |
28 | git checkout 1 -b L && | |
29 | test_commit left && | |
30 | git checkout 4 -b crossover && | |
31 | test_commit after-4 && | |
32 | git checkout initial -b more-L && | |
33 | test_commit after-initial | |
34 | ' | |
35 | ||
36 | test_expect_success 'log --graph with tricky octopus merge, no color' ' | |
37 | test_cmp_graph left octopus-merge <<-\EOF | |
38 | * left | |
39 | | *-. octopus-merge | |
40 | |/|\ \ | |
41 | | | | * 4 | |
42 | | | * | 3 | |
43 | | | |/ | |
44 | | * / 2 | |
45 | | |/ | |
46 | * / 1 | |
47 | |/ | |
48 | * initial | |
49 | EOF | |
50 | ' | |
51 | ||
52 | test_expect_success 'log --graph with tricky octopus merge with colors' ' | |
53 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
54 | cat >expect.colors <<-\EOF && | |
55 | * left | |
56 | <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge | |
57 | <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> | |
58 | <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4 | |
59 | <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3 | |
60 | <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
61 | <RED>|<RESET> * <MAGENTA>/<RESET> 2 | |
62 | <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
63 | * <MAGENTA>/<RESET> 1 | |
64 | <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
65 | * initial | |
66 | EOF | |
67 | test_cmp_colored_graph left octopus-merge | |
68 | ' | |
69 | ||
70 | # Repeat the previous two tests with "normal" octopus merge (i.e., | |
71 | # without the first parent skewing to the "left" branch column). | |
72 | ||
73 | test_expect_success 'log --graph with normal octopus merge, no color' ' | |
74 | test_cmp_graph octopus-merge <<-\EOF | |
75 | *---. octopus-merge | |
76 | |\ \ \ | |
77 | | | | * 4 | |
78 | | | * | 3 | |
79 | | | |/ | |
80 | | * / 2 | |
81 | | |/ | |
82 | * / 1 | |
83 | |/ | |
84 | * initial | |
85 | EOF | |
86 | ' | |
87 | ||
88 | test_expect_success 'log --graph with normal octopus merge with colors' ' | |
89 | cat >expect.colors <<-\EOF && | |
90 | *<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge | |
91 | <RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET> | |
92 | <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4 | |
93 | <RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3 | |
94 | <RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET> | |
95 | <RED>|<RESET> * <BLUE>/<RESET> 2 | |
96 | <RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET> | |
97 | * <BLUE>/<RESET> 1 | |
98 | <BLUE>|<RESET><BLUE>/<RESET> | |
99 | * initial | |
100 | EOF | |
101 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
102 | test_cmp_colored_graph octopus-merge | |
103 | ' | |
104 | ||
105 | test_expect_success 'log --graph with normal octopus merge and child, no color' ' | |
106 | test_cmp_graph after-merge <<-\EOF | |
107 | * after-merge | |
108 | *---. octopus-merge | |
109 | |\ \ \ | |
110 | | | | * 4 | |
111 | | | * | 3 | |
112 | | | |/ | |
113 | | * / 2 | |
114 | | |/ | |
115 | * / 1 | |
116 | |/ | |
117 | * initial | |
118 | EOF | |
119 | ' | |
120 | ||
121 | test_expect_success 'log --graph with normal octopus and child merge with colors' ' | |
122 | cat >expect.colors <<-\EOF && | |
123 | * after-merge | |
124 | *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge | |
125 | <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET> | |
126 | <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4 | |
127 | <GREEN>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3 | |
128 | <GREEN>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
129 | <GREEN>|<RESET> * <MAGENTA>/<RESET> 2 | |
130 | <GREEN>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
131 | * <MAGENTA>/<RESET> 1 | |
132 | <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
133 | * initial | |
134 | EOF | |
135 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
136 | test_cmp_colored_graph after-merge | |
137 | ' | |
138 | ||
139 | test_expect_success 'log --graph with tricky octopus merge and its child, no color' ' | |
140 | test_cmp_graph left after-merge <<-\EOF | |
141 | * left | |
142 | | * after-merge | |
143 | | *-. octopus-merge | |
144 | |/|\ \ | |
145 | | | | * 4 | |
146 | | | * | 3 | |
147 | | | |/ | |
148 | | * / 2 | |
149 | | |/ | |
150 | * / 1 | |
151 | |/ | |
152 | * initial | |
153 | EOF | |
154 | ' | |
155 | ||
156 | test_expect_success 'log --graph with tricky octopus merge and its child with colors' ' | |
157 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
158 | cat >expect.colors <<-\EOF && | |
159 | * left | |
160 | <RED>|<RESET> * after-merge | |
161 | <RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge | |
162 | <RED>|<RESET><RED>/<RESET><BLUE>|<RESET><MAGENTA>\<RESET> <CYAN>\<RESET> | |
163 | <RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4 | |
164 | <RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3 | |
165 | <RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET> | |
166 | <RED>|<RESET> * <CYAN>/<RESET> 2 | |
167 | <RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET> | |
168 | * <CYAN>/<RESET> 1 | |
169 | <CYAN>|<RESET><CYAN>/<RESET> | |
170 | * initial | |
171 | EOF | |
172 | test_cmp_colored_graph left after-merge | |
173 | ' | |
174 | ||
175 | test_expect_success 'log --graph with crossover in octopus merge, no color' ' | |
176 | test_cmp_graph after-4 octopus-merge <<-\EOF | |
177 | * after-4 | |
178 | | *---. octopus-merge | |
179 | | |\ \ \ | |
180 | | |_|_|/ | |
181 | |/| | | | |
182 | * | | | 4 | |
183 | | | | * 3 | |
184 | | |_|/ | |
185 | |/| | | |
186 | | | * 2 | |
187 | | |/ | |
188 | |/| | |
189 | | * 1 | |
190 | |/ | |
191 | * initial | |
192 | EOF | |
193 | ' | |
194 | ||
195 | test_expect_success 'log --graph with crossover in octopus merge with colors' ' | |
196 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
197 | cat >expect.colors <<-\EOF && | |
198 | * after-4 | |
199 | <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge | |
200 | <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET> | |
201 | <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET> | |
202 | <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> | |
203 | * <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> 4 | |
204 | <MAGENTA>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3 | |
205 | <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>_<RESET><YELLOW>|<RESET><MAGENTA>/<RESET> | |
206 | <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> | |
207 | <MAGENTA>|<RESET> <GREEN>|<RESET> * 2 | |
208 | <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>/<RESET> | |
209 | <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> | |
210 | <MAGENTA>|<RESET> * 1 | |
211 | <MAGENTA>|<RESET><MAGENTA>/<RESET> | |
212 | * initial | |
213 | EOF | |
214 | test_cmp_colored_graph after-4 octopus-merge | |
215 | ' | |
216 | ||
217 | test_expect_success 'log --graph with crossover in octopus merge and its child, no color' ' | |
218 | test_cmp_graph after-4 after-merge <<-\EOF | |
219 | * after-4 | |
220 | | * after-merge | |
221 | | *---. octopus-merge | |
222 | | |\ \ \ | |
223 | | |_|_|/ | |
224 | |/| | | | |
225 | * | | | 4 | |
226 | | | | * 3 | |
227 | | |_|/ | |
228 | |/| | | |
229 | | | * 2 | |
230 | | |/ | |
231 | |/| | |
232 | | * 1 | |
233 | |/ | |
234 | * initial | |
235 | EOF | |
236 | ' | |
237 | ||
238 | test_expect_success 'log --graph with crossover in octopus merge and its child with colors' ' | |
239 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
240 | cat >expect.colors <<-\EOF && | |
241 | * after-4 | |
242 | <RED>|<RESET> * after-merge | |
243 | <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge | |
244 | <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>\<RESET> | |
245 | <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET> | |
246 | <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> | |
247 | * <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> 4 | |
248 | <CYAN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3 | |
249 | <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>_<RESET><BLUE>|<RESET><CYAN>/<RESET> | |
250 | <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> | |
251 | <CYAN>|<RESET> <YELLOW>|<RESET> * 2 | |
252 | <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>/<RESET> | |
253 | <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> | |
254 | <CYAN>|<RESET> * 1 | |
255 | <CYAN>|<RESET><CYAN>/<RESET> | |
256 | * initial | |
257 | EOF | |
258 | test_cmp_colored_graph after-4 after-merge | |
259 | ' | |
260 | ||
261 | test_expect_success 'log --graph with unrelated commit and octopus tip, no color' ' | |
262 | test_cmp_graph after-initial octopus-merge <<-\EOF | |
263 | * after-initial | |
264 | | *---. octopus-merge | |
265 | | |\ \ \ | |
266 | | | | | * 4 | |
267 | | |_|_|/ | |
268 | |/| | | | |
269 | | | | * 3 | |
270 | | |_|/ | |
271 | |/| | | |
272 | | | * 2 | |
273 | | |/ | |
274 | |/| | |
275 | | * 1 | |
276 | |/ | |
277 | * initial | |
278 | EOF | |
279 | ' | |
280 | ||
281 | test_expect_success 'log --graph with unrelated commit and octopus tip with colors' ' | |
282 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
283 | cat >expect.colors <<-\EOF && | |
284 | * after-initial | |
285 | <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge | |
286 | <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET> | |
287 | <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4 | |
288 | <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET> | |
289 | <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> | |
290 | <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3 | |
291 | <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>/<RESET> | |
292 | <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> | |
293 | <RED>|<RESET> <GREEN>|<RESET> * 2 | |
294 | <RED>|<RESET> <GREEN>|<RESET><RED>/<RESET> | |
295 | <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> | |
296 | <RED>|<RESET> * 1 | |
297 | <RED>|<RESET><RED>/<RESET> | |
298 | * initial | |
299 | EOF | |
300 | test_cmp_colored_graph after-initial octopus-merge | |
301 | ' | |
302 | ||
303 | test_expect_success 'log --graph with unrelated commit and octopus child, no color' ' | |
304 | test_cmp_graph after-initial after-merge <<-\EOF | |
305 | * after-initial | |
306 | | * after-merge | |
307 | | *---. octopus-merge | |
308 | | |\ \ \ | |
309 | | | | | * 4 | |
310 | | |_|_|/ | |
311 | |/| | | | |
312 | | | | * 3 | |
313 | | |_|/ | |
314 | |/| | | |
315 | | | * 2 | |
316 | | |/ | |
317 | |/| | |
318 | | * 1 | |
319 | |/ | |
320 | * initial | |
321 | EOF | |
322 | ' | |
323 | ||
324 | test_expect_success 'log --graph with unrelated commit and octopus child with colors' ' | |
325 | test_config log.graphColors red,green,yellow,blue,magenta,cyan && | |
326 | cat >expect.colors <<-\EOF && | |
327 | * after-initial | |
328 | <RED>|<RESET> * after-merge | |
329 | <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge | |
330 | <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET> | |
331 | <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4 | |
332 | <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET> | |
333 | <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> | |
334 | <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3 | |
335 | <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET> | |
336 | <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> | |
337 | <RED>|<RESET> <YELLOW>|<RESET> * 2 | |
338 | <RED>|<RESET> <YELLOW>|<RESET><RED>/<RESET> | |
339 | <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> | |
340 | <RED>|<RESET> * 1 | |
341 | <RED>|<RESET><RED>/<RESET> | |
342 | * initial | |
343 | EOF | |
344 | test_cmp_colored_graph after-initial after-merge | |
345 | ' | |
346 | ||
347 | test_done |