]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4214-log-graph-octopus.sh
graph: rename `new_mapping` to `old_mapping`
[thirdparty/git.git] / t / t4214-log-graph-octopus.sh
CommitLineData
04005834
NP
1#!/bin/sh
2
3test_description='git log --graph of skewed left octopus merge.'
4
5. ./test-lib.sh
6
7test_expect_success 'set up merge history' '
63be8c8d
DL
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 &&
11c21f22 17 test_commit after-merge &&
63be8c8d 18 git checkout 1 -b L &&
11c21f22
DL
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
63be8c8d
DL
24'
25
26test_expect_success 'log --graph with tricky octopus merge, no color' '
04005834
NP
27 cat >expect.uncolored <<-\EOF &&
28 * left
0f0f389f
JC
29 | *-. octopus-merge
30 |/|\ \
04005834
NP
31 | | | * 4
32 | | * | 3
33 | | |/
34 | * | 2
35 | |/
36 * | 1
37 |/
38 * initial
39 EOF
25eb905e 40 git log --color=never --graph --date-order --pretty=tformat:%s left octopus-merge >actual.raw &&
63be8c8d
DL
41 sed "s/ *\$//" actual.raw >actual &&
42 test_cmp expect.uncolored actual
43'
44
45test_expect_success 'log --graph with tricky octopus merge with colors' '
46 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
04005834
NP
47 cat >expect.colors <<-\EOF &&
48 * left
0f0f389f
JC
49 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
50 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET>
04005834
NP
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>
56 * <MAGENTA>|<RESET> 1
57 <MAGENTA>|<RESET><MAGENTA>/<RESET>
58 * initial
59 EOF
25eb905e 60 git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
04005834
NP
61 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
62 test_cmp expect.colors actual.colors
63'
64
04005834
NP
65# Repeat the previous two tests with "normal" octopus merge (i.e.,
66# without the first parent skewing to the "left" branch column).
67
68test_expect_success 'log --graph with normal octopus merge, no color' '
69 cat >expect.uncolored <<-\EOF &&
70 *---. octopus-merge
71 |\ \ \
72 | | | * 4
73 | | * | 3
74 | | |/
75 | * | 2
76 | |/
77 * | 1
78 |/
79 * initial
80 EOF
25eb905e 81 git log --color=never --graph --date-order --pretty=tformat:%s octopus-merge >actual.raw &&
04005834
NP
82 sed "s/ *\$//" actual.raw >actual &&
83 test_cmp expect.uncolored actual
84'
85
86test_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>
95 * <BLUE>|<RESET> 1
96 <BLUE>|<RESET><BLUE>/<RESET>
97 * initial
98 EOF
99 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
25eb905e 100 git log --color=always --graph --date-order --pretty=tformat:%s octopus-merge >actual.colors.raw &&
04005834
NP
101 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
102 test_cmp expect.colors actual.colors
103'
11c21f22
DL
104
105test_expect_success 'log --graph with normal octopus merge and child, no color' '
106 cat >expect.uncolored <<-\EOF &&
107 * after-merge
108 *---. octopus-merge
109 |\ \ \
110 | | | * 4
111 | | * | 3
112 | | |/
113 | * | 2
114 | |/
115 * | 1
116 |/
117 * initial
118 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
122'
123
124test_expect_failure 'log --graph with normal octopus and child merge with colors' '
125 cat >expect.colors <<-\EOF &&
126 * after-merge
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>
136 * initial
137 EOF
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
142'
143
144test_expect_success 'log --graph with tricky octopus merge and its child, no color' '
145 cat >expect.uncolored <<-\EOF &&
146 * left
147 | * after-merge
0f0f389f
JC
148 | *-. octopus-merge
149 |/|\ \
11c21f22
DL
150 | | | * 4
151 | | * | 3
152 | | |/
153 | * | 2
154 | |/
155 * | 1
156 |/
157 * initial
158 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
162'
163
164test_expect_failure '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 &&
167 * left
168 <RED>|<RESET> * after-merge
0f0f389f
JC
169 <RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge
170 <RED>|<RESET><RED>/<RESET><BLUE>|<RESET><MAGENTA>\<RESET> <CYAN>\<RESET>
11c21f22
DL
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>
176 * <CYAN>|<RESET> 1
177 <CYAN>|<RESET><CYAN>/<RESET>
178 * initial
179 EOF
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
183'
184
185test_expect_success 'log --graph with crossover in octopus merge, no color' '
186 cat >expect.uncolored <<-\EOF &&
187 * after-4
188 | *---. octopus-merge
189 | |\ \ \
190 | |_|_|/
191 |/| | |
192 * | | | 4
193 | | | * 3
194 | |_|/
195 |/| |
196 | | * 2
197 | |/
198 |/|
199 | * 1
200 |/
201 * initial
202 EOF
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
206'
207
208test_expect_failure '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 &&
211 * after-4
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>
225 * initial
226 EOF
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
230'
231
232test_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
233 cat >expect.uncolored <<-\EOF &&
234 * after-4
235 | * after-merge
236 | *---. octopus-merge
237 | |\ \ \
238 | |_|_|/
239 |/| | |
240 * | | | 4
241 | | | * 3
242 | |_|/
243 |/| |
244 | | * 2
245 | |/
246 |/|
247 | * 1
248 |/
249 * initial
250 EOF
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
254'
255
256test_expect_failure '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 &&
259 * after-4
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>
272 <CYAN>|<RESET> * 1
273 <CYAN>|<RESET><CYAN>/<RESET>
274 * initial
275 EOF
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
279'
280
281test_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
282 cat >expect.uncolored <<-\EOF &&
283 * after-initial
284 | *---. octopus-merge
285 | |\ \ \
286 | | | | * 4
287 | |_|_|/
288 |/| | |
289 | | | * 3
290 | |_|/
291 |/| |
292 | | * 2
293 | |/
294 |/|
295 | * 1
296 |/
297 * initial
298 EOF
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
302'
303
304test_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 &&
307 * after-initial
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>
319 <RED>|<RESET> * 1
320 <RED>|<RESET><RED>/<RESET>
321 * initial
322 EOF
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
326'
327
328test_expect_success 'log --graph with unrelated commit and octopus child, no color' '
329 cat >expect.uncolored <<-\EOF &&
330 * after-initial
331 | * after-merge
332 | *---. octopus-merge
333 | |\ \ \
334 | | | | * 4
335 | |_|_|/
336 |/| | |
337 | | | * 3
338 | |_|/
339 |/| |
340 | | * 2
341 | |/
342 |/|
343 | * 1
344 |/
345 * initial
346 EOF
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
350'
351
352test_expect_failure '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 &&
355 * after-initial
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>
368 <RED>|<RESET> * 1
369 <RED>|<RESET><RED>/<RESET>
370 * initial
371 EOF
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
375'
376
04005834 377test_done