3 test_description='git log --graph of skewed left octopus merge.'
5 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
6 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
9 . "$TEST_DIRECTORY"/lib-log-graph.sh
13 lib_test_cmp_graph --color=never --date-order --format=%s "$@"
16 test_cmp_colored_graph () {
17 lib_test_cmp_colored_graph --date-order --format=%s "$@"
20 test_expect_success 'set up merge history' '
21 test_commit initial &&
23 git checkout main -b $i || return $?
24 # Make tag name different from branch name, to avoid
25 # ambiguity error when calling checkout.
26 test_commit $i $i $i tag$i || return $?
28 git checkout 1 -b merge &&
29 test_merge octopus-merge 1 2 3 4 &&
30 test_commit after-merge &&
31 git checkout 1 -b L &&
33 git checkout 4 -b crossover &&
34 test_commit after-4 &&
35 git checkout initial -b more-L &&
36 test_commit after-initial
39 test_expect_success 'log --graph with tricky octopus merge, no color' '
40 test_cmp_graph left octopus-merge <<-\EOF
55 test_expect_success 'log --graph with tricky octopus merge with colors' '
56 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
57 cat >expect.colors <<-\EOF &&
59 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
60 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET>
61 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
62 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
63 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
64 <RED>|<RESET> * <MAGENTA>/<RESET> 2
65 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
67 <MAGENTA>|<RESET><MAGENTA>/<RESET>
70 test_cmp_colored_graph left octopus-merge
73 # Repeat the previous two tests with "normal" octopus merge (i.e.,
74 # without the first parent skewing to the "left" branch column).
76 test_expect_success 'log --graph with normal octopus merge, no color' '
77 test_cmp_graph octopus-merge <<-\EOF
91 test_expect_success 'log --graph with normal octopus merge with colors' '
92 cat >expect.colors <<-\EOF &&
93 *<YELLOW>-<RESET><YELLOW>-<RESET><BLUE>-<RESET><BLUE>.<RESET> octopus-merge
94 <RED>|<RESET><GREEN>\<RESET> <YELLOW>\<RESET> <BLUE>\<RESET>
95 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 4
96 <RED>|<RESET> <GREEN>|<RESET> * <BLUE>|<RESET> 3
97 <RED>|<RESET> <GREEN>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
98 <RED>|<RESET> * <BLUE>/<RESET> 2
99 <RED>|<RESET> <BLUE>|<RESET><BLUE>/<RESET>
101 <BLUE>|<RESET><BLUE>/<RESET>
104 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
105 test_cmp_colored_graph octopus-merge
108 test_expect_success 'log --graph with normal octopus merge and child, no color' '
109 test_cmp_graph after-merge <<-\EOF
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 test_cmp_colored_graph after-merge
142 test_expect_success 'log --graph with tricky octopus merge and its child, no color' '
143 test_cmp_graph left after-merge <<-\EOF
159 test_expect_success 'log --graph with tricky octopus merge and its child with colors' '
160 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
161 cat >expect.colors <<-\EOF &&
163 <RED>|<RESET> * after-merge
164 <RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge
165 <RED>|<RESET><RED>/<RESET><BLUE>|<RESET><MAGENTA>\<RESET> <CYAN>\<RESET>
166 <RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
167 <RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3
168 <RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
169 <RED>|<RESET> * <CYAN>/<RESET> 2
170 <RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
172 <CYAN>|<RESET><CYAN>/<RESET>
175 test_cmp_colored_graph left after-merge
178 test_expect_success 'log --graph with crossover in octopus merge, no color' '
179 test_cmp_graph after-4 octopus-merge <<-\EOF
181 | *---. octopus-merge
198 test_expect_success 'log --graph with crossover in octopus merge with colors' '
199 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
200 cat >expect.colors <<-\EOF &&
202 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
203 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET>
204 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
205 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
206 * <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> 4
207 <MAGENTA>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
208 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>_<RESET><YELLOW>|<RESET><MAGENTA>/<RESET>
209 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
210 <MAGENTA>|<RESET> <GREEN>|<RESET> * 2
211 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>/<RESET>
212 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET>
213 <MAGENTA>|<RESET> * 1
214 <MAGENTA>|<RESET><MAGENTA>/<RESET>
217 test_cmp_colored_graph after-4 octopus-merge
220 test_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
221 test_cmp_graph after-4 after-merge <<-\EOF
224 | *---. octopus-merge
241 test_expect_success 'log --graph with crossover in octopus merge and its child with colors' '
242 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
243 cat >expect.colors <<-\EOF &&
245 <RED>|<RESET> * after-merge
246 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
247 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>\<RESET>
248 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
249 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
250 * <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> 4
251 <CYAN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
252 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>_<RESET><BLUE>|<RESET><CYAN>/<RESET>
253 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
254 <CYAN>|<RESET> <YELLOW>|<RESET> * 2
255 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>/<RESET>
256 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET>
258 <CYAN>|<RESET><CYAN>/<RESET>
261 test_cmp_colored_graph after-4 after-merge
264 test_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
265 test_cmp_graph after-initial octopus-merge <<-\EOF
267 | *---. octopus-merge
284 test_expect_success 'log --graph with unrelated commit and octopus tip with colors' '
285 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
286 cat >expect.colors <<-\EOF &&
288 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
289 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
290 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
291 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
292 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
293 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
294 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>/<RESET>
295 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
296 <RED>|<RESET> <GREEN>|<RESET> * 2
297 <RED>|<RESET> <GREEN>|<RESET><RED>/<RESET>
298 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET>
300 <RED>|<RESET><RED>/<RESET>
303 test_cmp_colored_graph after-initial octopus-merge
306 test_expect_success 'log --graph with unrelated commit and octopus child, no color' '
307 test_cmp_graph after-initial after-merge <<-\EOF
310 | *---. octopus-merge
327 test_expect_success 'log --graph with unrelated commit and octopus child with colors' '
328 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
329 cat >expect.colors <<-\EOF &&
331 <RED>|<RESET> * after-merge
332 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
333 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
334 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
335 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
336 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
337 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
338 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
339 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
340 <RED>|<RESET> <YELLOW>|<RESET> * 2
341 <RED>|<RESET> <YELLOW>|<RESET><RED>/<RESET>
342 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET>
344 <RED>|<RESET><RED>/<RESET>
347 test_cmp_colored_graph after-initial after-merge