list-objects-filter: don't memset after releasing filter struct
[git/debian.git] / t / t4214-log-graph-octopus.sh
blobf70c46bbbfa2c8fc9cc5ca1b620c9a80f29e382e
1 #!/bin/sh
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
8 . ./test-lib.sh
9 . "$TEST_DIRECTORY"/lib-log-graph.sh
11 test_cmp_graph () {
12 cat >expect &&
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 &&
22 for i in 1 2 3 4 ; do
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 $?
27 done &&
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 &&
32 test_commit left &&
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
41 * left
42 | *-. octopus-merge
43 |/|\ \
44 | | | * 4
45 | | * | 3
46 | | |/
47 | * / 2
48 | |/
49 * / 1
51 * initial
52 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 &&
58 * left
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>
66 * <MAGENTA>/<RESET> 1
67 <MAGENTA>|<RESET><MAGENTA>/<RESET>
68 * initial
69 EOF
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
78 *---. octopus-merge
79 |\ \ \
80 | | | * 4
81 | | * | 3
82 | | |/
83 | * / 2
84 | |/
85 * / 1
87 * initial
88 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>
100 * <BLUE>/<RESET> 1
101 <BLUE>|<RESET><BLUE>/<RESET>
102 * initial
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
110 * after-merge
111 *---. octopus-merge
112 |\ \ \
113 | | | * 4
114 | | * | 3
115 | | |/
116 | * / 2
117 | |/
118 * / 1
120 * initial
124 test_expect_success '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
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
144 * left
145 | * after-merge
146 | *-. octopus-merge
147 |/|\ \
148 | | | * 4
149 | | * | 3
150 | | |/
151 | * / 2
152 | |/
153 * / 1
155 * initial
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 &&
162 * left
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>
171 * <CYAN>/<RESET> 1
172 <CYAN>|<RESET><CYAN>/<RESET>
173 * initial
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
180 * after-4
181 | *---. octopus-merge
182 | |\ \ \
183 | |_|_|/
184 |/| | |
185 * | | | 4
186 | | | * 3
187 | |_|/
188 |/| |
189 | | * 2
190 | |/
192 | * 1
194 * initial
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 &&
201 * after-4
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>
215 * initial
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
222 * after-4
223 | * after-merge
224 | *---. octopus-merge
225 | |\ \ \
226 | |_|_|/
227 |/| | |
228 * | | | 4
229 | | | * 3
230 | |_|/
231 |/| |
232 | | * 2
233 | |/
235 | * 1
237 * initial
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 &&
244 * after-4
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>
257 <CYAN>|<RESET> * 1
258 <CYAN>|<RESET><CYAN>/<RESET>
259 * initial
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
266 * after-initial
267 | *---. octopus-merge
268 | |\ \ \
269 | | | | * 4
270 | |_|_|/
271 |/| | |
272 | | | * 3
273 | |_|/
274 |/| |
275 | | * 2
276 | |/
278 | * 1
280 * initial
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 &&
287 * after-initial
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>
299 <RED>|<RESET> * 1
300 <RED>|<RESET><RED>/<RESET>
301 * initial
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
308 * after-initial
309 | * after-merge
310 | *---. octopus-merge
311 | |\ \ \
312 | | | | * 4
313 | |_|_|/
314 |/| | |
315 | | | * 3
316 | |_|/
317 |/| |
318 | | * 2
319 | |/
321 | * 1
323 * initial
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 &&
330 * after-initial
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>
343 <RED>|<RESET> * 1
344 <RED>|<RESET><RED>/<RESET>
345 * initial
347 test_cmp_colored_graph after-initial after-merge
350 test_done