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_expect_success 'set up merge history' '
14 test_commit initial &&
16 git checkout master -b $i || return $?
17 # Make tag name different from branch name, to avoid
18 # ambiguity error when calling checkout.
19 test_commit $i $i $i tag$i || return $?
21 git checkout 1 -b merge &&
22 test_merge octopus-merge 1 2 3 4 &&
23 test_commit after-merge &&
24 git checkout 1 -b L &&
26 git checkout 4 -b crossover &&
27 test_commit after-4 &&
28 git checkout initial -b more-L &&
29 test_commit after-initial
32 test_expect_success 'log --graph with tricky octopus merge, no color' '
33 test_cmp_graph left octopus-merge <<-\EOF
48 test_expect_success 'log --graph with tricky octopus merge with colors' '
49 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
50 cat >expect.colors <<-\EOF &&
52 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
53 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET>
54 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
55 <RED>|<RESET> <YELLOW>|<RESET> * <MAGENTA>|<RESET> 3
56 <RED>|<RESET> <YELLOW>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
57 <RED>|<RESET> * <MAGENTA>/<RESET> 2
58 <RED>|<RESET> <MAGENTA>|<RESET><MAGENTA>/<RESET>
60 <MAGENTA>|<RESET><MAGENTA>/<RESET>
63 git log --color=always --graph --date-order --pretty=tformat:%s left octopus-merge >actual.colors.raw &&
64 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
65 test_cmp expect.colors actual.colors
68 # Repeat the previous two tests with "normal" octopus merge (i.e.,
69 # without the first parent skewing to the "left" branch column).
71 test_expect_success 'log --graph with normal octopus merge, no color' '
72 test_cmp_graph octopus-merge <<-\EOF
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 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 git log --color=always --graph --date-order --pretty=tformat:%s after-merge >actual.colors.raw &&
137 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
138 test_cmp expect.colors actual.colors
141 test_expect_success 'log --graph with tricky octopus merge and its child, no color' '
142 test_cmp_graph left after-merge <<-\EOF
158 test_expect_success 'log --graph with tricky octopus merge and its child with colors' '
159 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
160 cat >expect.colors <<-\EOF &&
162 <RED>|<RESET> * after-merge
163 <RED>|<RESET> *<CYAN>-<RESET><CYAN>.<RESET> octopus-merge
164 <RED>|<RESET><RED>/<RESET><BLUE>|<RESET><MAGENTA>\<RESET> <CYAN>\<RESET>
165 <RED>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
166 <RED>|<RESET> <BLUE>|<RESET> * <CYAN>|<RESET> 3
167 <RED>|<RESET> <BLUE>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
168 <RED>|<RESET> * <CYAN>/<RESET> 2
169 <RED>|<RESET> <CYAN>|<RESET><CYAN>/<RESET>
171 <CYAN>|<RESET><CYAN>/<RESET>
174 git log --color=always --graph --date-order --pretty=tformat:%s left after-merge >actual.colors.raw &&
175 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
176 test_cmp expect.colors actual.colors
179 test_expect_success 'log --graph with crossover in octopus merge, no color' '
180 test_cmp_graph after-4 octopus-merge <<-\EOF
182 | *---. octopus-merge
199 test_expect_success 'log --graph with crossover in octopus merge with colors' '
200 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
201 cat >expect.colors <<-\EOF &&
203 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
204 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <RED>\<RESET>
205 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
206 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
207 * <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> 4
208 <MAGENTA>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
209 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>_<RESET><YELLOW>|<RESET><MAGENTA>/<RESET>
210 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
211 <MAGENTA>|<RESET> <GREEN>|<RESET> * 2
212 <MAGENTA>|<RESET> <GREEN>|<RESET><MAGENTA>/<RESET>
213 <MAGENTA>|<RESET><MAGENTA>/<RESET><GREEN>|<RESET>
214 <MAGENTA>|<RESET> * 1
215 <MAGENTA>|<RESET><MAGENTA>/<RESET>
218 git log --color=always --graph --date-order --pretty=tformat:%s after-4 octopus-merge >actual.colors.raw &&
219 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
220 test_cmp expect.colors actual.colors
223 test_expect_success 'log --graph with crossover in octopus merge and its child, no color' '
224 test_cmp_graph after-4 after-merge <<-\EOF
227 | *---. octopus-merge
244 test_expect_success 'log --graph with crossover in octopus merge and its child with colors' '
245 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
246 cat >expect.colors <<-\EOF &&
248 <RED>|<RESET> * after-merge
249 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><RED>-<RESET><RED>.<RESET> octopus-merge
250 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <RED>\<RESET>
251 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
252 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
253 * <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> 4
254 <CYAN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
255 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>_<RESET><BLUE>|<RESET><CYAN>/<RESET>
256 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
257 <CYAN>|<RESET> <YELLOW>|<RESET> * 2
258 <CYAN>|<RESET> <YELLOW>|<RESET><CYAN>/<RESET>
259 <CYAN>|<RESET><CYAN>/<RESET><YELLOW>|<RESET>
261 <CYAN>|<RESET><CYAN>/<RESET>
264 git log --color=always --graph --date-order --pretty=tformat:%s after-4 after-merge >actual.colors.raw &&
265 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
266 test_cmp expect.colors actual.colors
269 test_expect_success 'log --graph with unrelated commit and octopus tip, no color' '
270 test_cmp_graph after-initial octopus-merge <<-\EOF
272 | *---. octopus-merge
289 test_expect_success 'log --graph with unrelated commit and octopus tip with colors' '
290 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
291 cat >expect.colors <<-\EOF &&
293 <RED>|<RESET> *<BLUE>-<RESET><BLUE>-<RESET><MAGENTA>-<RESET><MAGENTA>.<RESET> octopus-merge
294 <RED>|<RESET> <GREEN>|<RESET><YELLOW>\<RESET> <BLUE>\<RESET> <MAGENTA>\<RESET>
295 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 4
296 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
297 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET>
298 <RED>|<RESET> <GREEN>|<RESET> <YELLOW>|<RESET> * 3
299 <RED>|<RESET> <GREEN>|<RESET><RED>_<RESET><YELLOW>|<RESET><RED>/<RESET>
300 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET> <YELLOW>|<RESET>
301 <RED>|<RESET> <GREEN>|<RESET> * 2
302 <RED>|<RESET> <GREEN>|<RESET><RED>/<RESET>
303 <RED>|<RESET><RED>/<RESET><GREEN>|<RESET>
305 <RED>|<RESET><RED>/<RESET>
308 git log --color=always --graph --date-order --pretty=tformat:%s after-initial octopus-merge >actual.colors.raw &&
309 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
310 test_cmp expect.colors actual.colors
313 test_expect_success 'log --graph with unrelated commit and octopus child, no color' '
314 test_cmp_graph after-initial after-merge <<-\EOF
317 | *---. octopus-merge
334 test_expect_success 'log --graph with unrelated commit and octopus child with colors' '
335 test_config log.graphColors red,green,yellow,blue,magenta,cyan &&
336 cat >expect.colors <<-\EOF &&
338 <RED>|<RESET> * after-merge
339 <RED>|<RESET> *<MAGENTA>-<RESET><MAGENTA>-<RESET><CYAN>-<RESET><CYAN>.<RESET> octopus-merge
340 <RED>|<RESET> <YELLOW>|<RESET><BLUE>\<RESET> <MAGENTA>\<RESET> <CYAN>\<RESET>
341 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET> * 4
342 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>_<RESET><MAGENTA>|<RESET><RED>/<RESET>
343 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET> <MAGENTA>|<RESET>
344 <RED>|<RESET> <YELLOW>|<RESET> <BLUE>|<RESET> * 3
345 <RED>|<RESET> <YELLOW>|<RESET><RED>_<RESET><BLUE>|<RESET><RED>/<RESET>
346 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET> <BLUE>|<RESET>
347 <RED>|<RESET> <YELLOW>|<RESET> * 2
348 <RED>|<RESET> <YELLOW>|<RESET><RED>/<RESET>
349 <RED>|<RESET><RED>/<RESET><YELLOW>|<RESET>
351 <RED>|<RESET><RED>/<RESET>
354 git log --color=always --graph --date-order --pretty=tformat:%s after-initial after-merge >actual.colors.raw &&
355 test_decode_color <actual.colors.raw | sed "s/ *\$//" >actual.colors &&
356 test_cmp expect.colors actual.colors