3 test_description='git log --graph of skewed left octopus merge.'
7 test_expect_success 'set up merge history' '
10 git checkout master -b $i || return $?
11 # Make tag name different from branch name, to avoid
12 # ambiguity error when calling checkout.
13 test_commit $i $i $i tag$i || return $?
15 git checkout 1 -b merge &&
16 test_merge octopus-merge 1 2 3 4 &&
17 test_commit after-merge &&
18 git checkout 1 -b L &&
20 git checkout 4 -b crossover &&
21 test_commit after-4 &&
22 git checkout initial -b more-L &&
23 test_commit after-initial
26 test_expect_success 'log --graph with tricky octopus merge, no color' '
27 cat >expect.uncolored <<-\EOF &&
41 git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
42 sed "s/ *\$//" actual.raw >actual &&
43 test_cmp expect.uncolored actual
46 test_expect_success 'log --graph with tricky octopus merge with colors' '
47 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
48 cat >expect.colors <<-\EOF &&
50 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
51 <RED>|<RESET> <RED>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
52 <RED>|<RESET><RED>/<RESET> <YELLOW>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET>
53 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
54 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
55 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
56 <RED>|<RESET> * <MAGENTA>|<RESET> 2
57 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
59 <MAGENTA>|<RESET><MAGENTA>/<RESET>
62 git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
63 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
64 test_cmp expect.colors actual.colors
67 # Repeat the previous two tests with "normal" octopus merge (i.e.,
68 # without the first parent skewing to the "left" branch column).
70 test_expect_success 'log --graph with normal octopus merge, no color' '
71 cat >expect.uncolored <<-\EOF &&
83 git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
84 sed "s/ *\$//" actual.raw >actual &&
85 test_cmp expect.uncolored actual
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>
98 <BLUE>|<RESET><BLUE>/<RESET>
101 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
102 git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
103 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
104 test_cmp expect.colors actual.colors
107 test_expect_success 'log --graph with normal octopus merge and child, no color' '
108 cat >expect.uncolored <<-\EOF &&
121 git log --color=never --graph --date-order --pretty=tformat:%s after-merge >actual.raw &&
122 sed "s/ *\$//" actual.raw >actual &&
123 test_cmp expect.uncolored actual
126 test_expect_failure 'log --graph with normal octopus and child merge with colors' '
127 cat >expect.colors <<-\EOF &&
129 *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
130 <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
131 <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
132 <GREEN>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
133 <GREEN>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
134 <GREEN>|<RESET> * <MAGENTA>|<RESET> 2
135 <GREEN>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
136 * <MAGENTA>|<RESET> 1
137 <MAGENTA>|<RESET><MAGENTA>/<RESET>
140 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
141 git log --color=always --graph --date-order --pretty=tformat:%s after-merge >actual.colors.raw &&
142 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
143 test_cmp expect.colors actual.colors
146 test_expect_success 'log --graph with tricky octopus merge and its child, no color' '
147 cat >expect.uncolored <<-\EOF &&
150 | *---. octopus-merge
162 git log --color=never --graph --date-order --pretty=tformat:%s left after-merge >actual.raw &&
163 sed "s/ *\$//" actual.raw >actual &&
164 test_cmp expect.uncolored actual
167 test_expect_failure 'log --graph with tricky octopus merge and its child with colors' '
168 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
169 cat >expect.colors <<-\EOF &&
171 <RED>|<RESET> * after-merge
172 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
173 <RED>|<RESET> <RED>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
174 <RED>|<RESET><RED>/<RESET> <BLUE>/<RESET> <MAGENTA>/<RESET> <CYAN>/<RESET>
175 <RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
176 <RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3
177 <RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
178 <RED>|<RESET> * <CYAN>|<RESET> 2
179 <RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
181 <CYAN>|<RESET><CYAN>/<RESET>
184 git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw &&
185 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
186 test_cmp expect.colors actual.colors
189 test_expect_success 'log --graph with crossover in octopus merge, no color' '
190 cat >expect.uncolored <<-\EOF &&
192 | *---. octopus-merge
207 git log --color=never --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.raw &&
208 sed "s/ *\$//" actual.raw >actual &&
209 test_cmp expect.uncolored actual
212 test_expect_failure 'log --graph with crossover in octopus merge with colors' '
213 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
214 cat >expect.colors <<-\EOF &&
216 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
217 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET>
218 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
219 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
220 * <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> 4
221 <MAGENTA>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
222 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>_<RESET><YELLOW>|<RESET><MAGENTA>/<RESET>
223 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
224 <MAGENTA>|<RESET> <GREEN>|<RESET> * 2
225 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>/<RESET>
226 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET>
227 <MAGENTA>|<RESET> * 1
228 <MAGENTA>|<RESET><MAGENTA>/<RESET>
231 git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw &&
232 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
233 test_cmp expect.colors actual.colors
236 test_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
237 cat >expect.uncolored <<-\EOF &&
240 | *---. octopus-merge
255 git log --color=never --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.raw &&
256 sed "s/ *\$//" actual.raw >actual &&
257 test_cmp expect.uncolored actual
260 test_expect_failure 'log --graph with crossover in octopus merge and its child with colors' '
261 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
262 cat >expect.colors <<-\EOF &&
264 <RED>|<RESET> * after-merge
265 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
266 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>\<RESET>
267 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
268 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
269 * <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> 4
270 <CYAN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
271 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>_<RESET><BLUE>|<RESET><CYAN>/<RESET>
272 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
273 <CYAN>|<RESET> <YELLOW>|<RESET> * 2
274 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>/<RESET>
275 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET>
277 <CYAN>|<RESET><CYAN>/<RESET>
280 git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw &&
281 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
282 test_cmp expect.colors actual.colors
285 test_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
286 cat >expect.uncolored <<-\EOF &&
288 | *---. octopus-merge
303 git log --color=never --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.raw &&
304 sed "s/ *\$//" actual.raw >actual &&
305 test_cmp expect.uncolored actual
308 test_expect_success 'log --graph with unrelated commit and octopus tip with colors' '
309 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
310 cat >expect.colors <<-\EOF &&
312 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
313 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
314 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
315 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
316 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
317 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
318 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>/<RESET>
319 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
320 <RED>|<RESET> <GREEN>|<RESET> * 2
321 <RED>|<RESET> <GREEN>|<RESET><RED>/<RESET>
322 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET>
324 <RED>|<RESET><RED>/<RESET>
327 git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw &&
328 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
329 test_cmp expect.colors actual.colors
332 test_expect_success 'log --graph with unrelated commit and octopus child, no color' '
333 cat >expect.uncolored <<-\EOF &&
336 | *---. octopus-merge
351 git log --color=never --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.raw &&
352 sed "s/ *\$//" actual.raw >actual &&
353 test_cmp expect.uncolored actual
356 test_expect_failure 'log --graph with unrelated commit and octopus child with colors' '
357 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
358 cat >expect.colors <<-\EOF &&
360 <RED>|<RESET> * after-merge
361 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
362 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
363 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
364 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
365 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
366 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
367 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
368 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
369 <RED>|<RESET> <YELLOW>|<RESET> * 2
370 <RED>|<RESET> <YELLOW>|<RESET><RED>/<RESET>
371 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET>
373 <RED>|<RESET><RED>/<RESET>
376 git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw &&
377 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
378 test_cmp expect.colors actual.colors