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 &&
40 git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
41 sed "s/ *\$//" actual.raw >actual &&
42 test_cmp expect.uncolored actual
45 test_expect_success
'log --graph with tricky octopus merge with colors' '
46 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
47 cat >expect.colors <<-\EOF &&
49 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
50 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET>
51 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
52 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
53 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
54 <RED>|<RESET> * <MAGENTA>/<RESET> 2
55 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
57 <MAGENTA>|<RESET><MAGENTA>/<RESET>
60 git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
61 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
62 test_cmp expect.colors actual.colors
65 # Repeat the previous two tests with "normal" octopus merge (i.e.,
66 # without the first parent skewing to the "left" branch column).
68 test_expect_success
'log --graph with normal octopus merge, no color' '
69 cat >expect.uncolored <<-\EOF &&
81 git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
82 sed "s/ *\$//" actual.raw >actual &&
83 test_cmp expect.uncolored actual
86 test_expect_success
'log --graph with normal octopus merge with colors' '
87 cat >expect.colors <<-\EOF &&
88 *<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge
89 <RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET>
90 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4
91 <RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3
92 <RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
93 <RED>|<RESET> * <BLUE>/<RESET> 2
94 <RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
96 <BLUE>|<RESET><BLUE>/<RESET>
99 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
100 git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
101 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
102 test_cmp expect.colors actual.colors
105 test_expect_success
'log --graph with normal octopus merge and child, no color' '
106 cat >expect.uncolored <<-\EOF &&
119 git log --color=never --graph --date-order --pretty=tformat:%s after-merge >actual.raw &&
120 sed "s/ *\$//" actual.raw >actual &&
121 test_cmp expect.uncolored actual
124 test_expect_success
'log --graph with normal octopus and child merge with colors' '
125 cat >expect.colors <<-\EOF &&
127 *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
128 <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
129 <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
130 <GREEN>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
131 <GREEN>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
132 <GREEN>|<RESET> * <MAGENTA>/<RESET> 2
133 <GREEN>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
134 * <MAGENTA>/<RESET> 1
135 <MAGENTA>|<RESET><MAGENTA>/<RESET>
138 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
139 git log --color=always --graph --date-order --pretty=tformat:%s after-merge >actual.colors.raw &&
140 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
141 test_cmp expect.colors actual.colors
144 test_expect_success
'log --graph with tricky octopus merge and its child, no color' '
145 cat >expect.uncolored <<-\EOF &&
159 git log --color=never --graph --date-order --pretty=tformat:%s left after-merge >actual.raw &&
160 sed "s/ *\$//" actual.raw >actual &&
161 test_cmp expect.uncolored actual
164 test_expect_success
'log --graph with tricky octopus merge and its child with colors' '
165 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
166 cat >expect.colors <<-\EOF &&
168 <RED>|<RESET> * after-merge
169 <RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge
170 <RED>|<RESET><RED>/<RESET><BLUE>|<RESET><MAGENTA>\<RESET> <CYAN>\<RESET>
171 <RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
172 <RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3
173 <RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
174 <RED>|<RESET> * <CYAN>/<RESET> 2
175 <RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
177 <CYAN>|<RESET><CYAN>/<RESET>
180 git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw &&
181 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
182 test_cmp expect.colors actual.colors
185 test_expect_success
'log --graph with crossover in octopus merge, no color' '
186 cat >expect.uncolored <<-\EOF &&
188 | *---. octopus-merge
203 git log --color=never --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.raw &&
204 sed "s/ *\$//" actual.raw >actual &&
205 test_cmp expect.uncolored actual
208 test_expect_success
'log --graph with crossover in octopus merge with colors' '
209 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
210 cat >expect.colors <<-\EOF &&
212 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
213 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET>
214 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
215 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
216 * <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> 4
217 <MAGENTA>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
218 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>_<RESET><YELLOW>|<RESET><MAGENTA>/<RESET>
219 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
220 <MAGENTA>|<RESET> <GREEN>|<RESET> * 2
221 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>/<RESET>
222 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET>
223 <MAGENTA>|<RESET> * 1
224 <MAGENTA>|<RESET><MAGENTA>/<RESET>
227 git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw &&
228 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
229 test_cmp expect.colors actual.colors
232 test_expect_success
'log --graph with crossover in octopus merge and its child, no color' '
233 cat >expect.uncolored <<-\EOF &&
236 | *---. octopus-merge
251 git log --color=never --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.raw &&
252 sed "s/ *\$//" actual.raw >actual &&
253 test_cmp expect.uncolored actual
256 test_expect_success
'log --graph with crossover in octopus merge and its child with colors' '
257 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
258 cat >expect.colors <<-\EOF &&
260 <RED>|<RESET> * after-merge
261 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
262 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>\<RESET>
263 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
264 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
265 * <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> 4
266 <CYAN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
267 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>_<RESET><BLUE>|<RESET><CYAN>/<RESET>
268 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
269 <CYAN>|<RESET> <YELLOW>|<RESET> * 2
270 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>/<RESET>
271 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET>
273 <CYAN>|<RESET><CYAN>/<RESET>
276 git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw &&
277 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
278 test_cmp expect.colors actual.colors
281 test_expect_success
'log --graph with unrelated commit and octopus tip, no color' '
282 cat >expect.uncolored <<-\EOF &&
284 | *---. octopus-merge
299 git log --color=never --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.raw &&
300 sed "s/ *\$//" actual.raw >actual &&
301 test_cmp expect.uncolored actual
304 test_expect_success
'log --graph with unrelated commit and octopus tip with colors' '
305 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
306 cat >expect.colors <<-\EOF &&
308 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
309 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
310 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
311 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
312 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
313 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
314 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>/<RESET>
315 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
316 <RED>|<RESET> <GREEN>|<RESET> * 2
317 <RED>|<RESET> <GREEN>|<RESET><RED>/<RESET>
318 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET>
320 <RED>|<RESET><RED>/<RESET>
323 git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw &&
324 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
325 test_cmp expect.colors actual.colors
328 test_expect_success
'log --graph with unrelated commit and octopus child, no color' '
329 cat >expect.uncolored <<-\EOF &&
332 | *---. octopus-merge
347 git log --color=never --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.raw &&
348 sed "s/ *\$//" actual.raw >actual &&
349 test_cmp expect.uncolored actual
352 test_expect_success
'log --graph with unrelated commit and octopus child with colors' '
353 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
354 cat >expect.colors <<-\EOF &&
356 <RED>|<RESET> * after-merge
357 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
358 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
359 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
360 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
361 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
362 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
363 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
364 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
365 <RED>|<RESET> <YELLOW>|<RESET> * 2
366 <RED>|<RESET> <YELLOW>|<RESET><RED>/<RESET>
367 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET>
369 <RED>|<RESET><RED>/<RESET>
372 git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw &&
373 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
374 test_cmp expect.colors actual.colors