unpack-trees: add progress to clear_ce_flags()
[git/debian.git] / t / t4214-log-graph-octopus.sh
blob3ae8e51e5002691e43615c9285d5501a802dff1a
1 #!/bin/sh
3 test_description='git log --graph of skewed left octopus merge.'
5 . ./test-lib.sh
7 test_expect_success 'set up merge history' '
8 test_commit initial &&
9 for i in 1 2 3 4 ; do
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 $?
14 done &&
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 &&
19 test_commit left &&
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 &&
28 * left
29 | *---. octopus-merge
30 | |\ \ \
31 |/ / / /
32 | | | * 4
33 | | * | 3
34 | | |/
35 | * | 2
36 | |/
37 * | 1
39 * initial
40 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 &&
49 * left
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>
58 * <MAGENTA>|<RESET> 1
59 <MAGENTA>|<RESET><MAGENTA>/<RESET>
60 * initial
61 EOF
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 &&
72 *---. octopus-merge
73 |\ \ \
74 | | | * 4
75 | | * | 3
76 | | |/
77 | * | 2
78 | |/
79 * | 1
81 * initial
82 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>
97 * <BLUE>|<RESET> 1
98 <BLUE>|<RESET><BLUE>/<RESET>
99 * initial
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 &&
109 * after-merge
110 *---. octopus-merge
111 |\ \ \
112 | | | * 4
113 | | * | 3
114 | | |/
115 | * | 2
116 | |/
117 * | 1
119 * initial
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 &&
128 * after-merge
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>
138 * initial
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 &&
148 * left
149 | * after-merge
150 | *---. octopus-merge
151 | |\ \ \
152 |/ / / /
153 | | | * 4
154 | | * | 3
155 | | |/
156 | * | 2
157 | |/
158 * | 1
160 * initial
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 &&
170 * left
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>
180 * <CYAN>|<RESET> 1
181 <CYAN>|<RESET><CYAN>/<RESET>
182 * initial
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 &&
191 * after-4
192 | *---. octopus-merge
193 | |\ \ \
194 | |_|_|/
195 |/| | |
196 * | | | 4
197 | | | * 3
198 | |_|/
199 |/| |
200 | | * 2
201 | |/
203 | * 1
205 * initial
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 &&
215 * after-4
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>
229 * initial
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 &&
238 * after-4
239 | * after-merge
240 | *---. octopus-merge
241 | |\ \ \
242 | |_|_|/
243 |/| | |
244 * | | | 4
245 | | | * 3
246 | |_|/
247 |/| |
248 | | * 2
249 | |/
251 | * 1
253 * initial
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 &&
263 * after-4
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>
276 <CYAN>|<RESET> * 1
277 <CYAN>|<RESET><CYAN>/<RESET>
278 * initial
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 &&
287 * after-initial
288 | *---. octopus-merge
289 | |\ \ \
290 | | | | * 4
291 | |_|_|/
292 |/| | |
293 | | | * 3
294 | |_|/
295 |/| |
296 | | * 2
297 | |/
299 | * 1
301 * initial
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 &&
311 * after-initial
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>
323 <RED>|<RESET> * 1
324 <RED>|<RESET><RED>/<RESET>
325 * initial
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 &&
334 * after-initial
335 | * after-merge
336 | *---. octopus-merge
337 | |\ \ \
338 | | | | * 4
339 | |_|_|/
340 |/| | |
341 | | | * 3
342 | |_|/
343 |/| |
344 | | * 2
345 | |/
347 | * 1
349 * initial
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 &&
359 * after-initial
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>
372 <RED>|<RESET> * 1
373 <RED>|<RESET><RED>/<RESET>
374 * initial
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
381 test_done