3 test_description
='git log --graph of skewed left octopus merge.'
6 .
"$TEST_DIRECTORY"/lib-log-graph.sh
10 lib_test_cmp_graph
--color=never
--date-order --format=%s
"$@"
13 test_cmp_colored_graph
() {
14 lib_test_cmp_colored_graph
--date-order --format=%s
"$@"
17 test_expect_success
'set up merge history' '
18 test_commit initial &&
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 $?
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 &&
30 git checkout 4 -b crossover &&
31 test_commit after-4 &&
32 git checkout initial -b more-L &&
33 test_commit after-initial
36 test_expect_success
'log --graph with tricky octopus merge, no color' '
37 test_cmp_graph left octopus-merge <<-\EOF
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 &&
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>
64 <MAGENTA>|<RESET><MAGENTA>/<RESET>
67 test_cmp_colored_graph left octopus-merge
70 # Repeat the previous two tests with "normal" octopus merge (i.e.,
71 # without the first parent skewing to the "left" branch column).
73 test_expect_success
'log --graph with normal octopus merge, no color' '
74 test_cmp_graph octopus-merge <<-\EOF
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 test_cmp_colored_graph octopus-merge
105 test_expect_success
'log --graph with normal octopus merge and child, no color' '
106 test_cmp_graph after-merge <<-\EOF
121 test_expect_success
'log --graph with normal octopus and child merge with colors' '
122 cat >expect.colors <<-\EOF &&
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>
135 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
136 test_cmp_colored_graph after-merge
139 test_expect_success
'log --graph with tricky octopus merge and its child, no color' '
140 test_cmp_graph left after-merge <<-\EOF
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 &&
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>
169 <CYAN>|<RESET><CYAN>/<RESET>
172 test_cmp_colored_graph left after-merge
175 test_expect_success
'log --graph with crossover in octopus merge, no color' '
176 test_cmp_graph after-4 octopus-merge <<-\EOF
178 | *---. octopus-merge
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 &&
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>
214 test_cmp_colored_graph after-4 octopus-merge
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
221 | *---. octopus-merge
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 &&
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>
255 <CYAN>|<RESET><CYAN>/<RESET>
258 test_cmp_colored_graph after-4 after-merge
261 test_expect_success
'log --graph with unrelated commit and octopus tip, no color' '
262 test_cmp_graph after-initial octopus-merge <<-\EOF
264 | *---. octopus-merge
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 &&
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>
297 <RED>|<RESET><RED>/<RESET>
300 test_cmp_colored_graph after-initial octopus-merge
303 test_expect_success
'log --graph with unrelated commit and octopus child, no color' '
304 test_cmp_graph after-initial after-merge <<-\EOF
307 | *---. octopus-merge
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 &&
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>
341 <RED>|<RESET><RED>/<RESET>
344 test_cmp_colored_graph after-initial after-merge