t6600-test-reach: generalize *_three_modes

In a preparatory step to implement generation number v2, we add tests to ensure Git can read and parse commit-graph files without Generation Data chunk. These files represent commit-graph files written by Old Git and are neccesary for backward compatability. We extend run_three_modes() and test_three_modes() to *_all_modes() with the fourth mode being "commit-graph without generation data chunk". Signed-off-by: Abhishek Kumar <abhishekkumar8222@gmail.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Abhishek Kumar committed Jan 16, 2021 at 18:11 UTC c0ef139843a27f67a1e02c41944a16a736493351
1 file changed +31 -31
t/t6600-test-reach.sh
+31 -31
@@ -58,7 +58,7 @@ test_expect_success 'setup' '
58 git config core.commitGraph true
59 '
60
61 -run_three_modes () {
61 +run_all_modes () {
62 test_when_finished rm -rf .git/objects/info/commit-graph &&
63 "$@" <input >actual &&
64 test_cmp expect actual &&
@@ -70,8 +70,8 @@ run_three_modes () {
70 test_cmp expect actual
71 }
72
73 -test_three_modes () {
74 - run_three_modes test-tool reach "$@"
73 +test_all_modes () {
74 + run_all_modes test-tool reach "$@"
75 }
76
77 test_expect_success 'ref_newer:miss' '
@@ -80,7 +80,7 @@ test_expect_success 'ref_newer:miss' '
80 B:commit-4-9
81 EOF
82 echo "ref_newer(A,B):0" >expect &&
83 - test_three_modes ref_newer
83 + test_all_modes ref_newer
84 '
85
86 test_expect_success 'ref_newer:hit' '
@@ -89,7 +89,7 @@ test_expect_success 'ref_newer:hit' '
89 B:commit-2-3
90 EOF
91 echo "ref_newer(A,B):1" >expect &&
92 - test_three_modes ref_newer
92 + test_all_modes ref_newer
93 '
94
95 test_expect_success 'in_merge_bases:hit' '
@@ -98,7 +98,7 @@ test_expect_success 'in_merge_bases:hit' '
98 B:commit-8-8
99 EOF
100 echo "in_merge_bases(A,B):1" >expect &&
101 - test_three_modes in_merge_bases
101 + test_all_modes in_merge_bases
102 '
103
104 test_expect_success 'in_merge_bases:miss' '
@@ -107,7 +107,7 @@ test_expect_success 'in_merge_bases:miss' '
107 B:commit-5-9
108 EOF
109 echo "in_merge_bases(A,B):0" >expect &&
110 - test_three_modes in_merge_bases
110 + test_all_modes in_merge_bases
111 '
112
113 test_expect_success 'in_merge_bases_many:hit' '
@@ -117,7 +117,7 @@ test_expect_success 'in_merge_bases_many:hit' '
117 X:commit-5-7
118 EOF
119 echo "in_merge_bases_many(A,X):1" >expect &&
120 - test_three_modes in_merge_bases_many
120 + test_all_modes in_merge_bases_many
121 '
122
123 test_expect_success 'in_merge_bases_many:miss' '
@@ -127,7 +127,7 @@ test_expect_success 'in_merge_bases_many:miss' '
127 X:commit-8-6
128 EOF
129 echo "in_merge_bases_many(A,X):0" >expect &&
130 - test_three_modes in_merge_bases_many
130 + test_all_modes in_merge_bases_many
131 '
132
133 test_expect_success 'in_merge_bases_many:miss-heuristic' '
@@ -137,7 +137,7 @@ test_expect_success 'in_merge_bases_many:miss-heuristic' '
137 X:commit-6-6
138 EOF
139 echo "in_merge_bases_many(A,X):0" >expect &&
140 - test_three_modes in_merge_bases_many
140 + test_all_modes in_merge_bases_many
141 '
142
143 test_expect_success 'is_descendant_of:hit' '
@@ -148,7 +148,7 @@ test_expect_success 'is_descendant_of:hit' '
148 X:commit-1-1
149 EOF
150 echo "is_descendant_of(A,X):1" >expect &&
151 - test_three_modes is_descendant_of
151 + test_all_modes is_descendant_of
152 '
153
154 test_expect_success 'is_descendant_of:miss' '
@@ -159,7 +159,7 @@ test_expect_success 'is_descendant_of:miss' '
159 X:commit-7-6
160 EOF
161 echo "is_descendant_of(A,X):0" >expect &&
162 - test_three_modes is_descendant_of
162 + test_all_modes is_descendant_of
163 '
164
165 test_expect_success 'get_merge_bases_many' '
@@ -174,7 +174,7 @@ test_expect_success 'get_merge_bases_many' '
174 git rev-parse commit-5-6 \
175 commit-4-7 | sort
176 } >expect &&
177 - test_three_modes get_merge_bases_many
177 + test_all_modes get_merge_bases_many
178 '
179
180 test_expect_success 'reduce_heads' '
@@ -196,7 +196,7 @@ test_expect_success 'reduce_heads' '
196 commit-2-8 \
197 commit-1-10 | sort
198 } >expect &&
199 - test_three_modes reduce_heads
199 + test_all_modes reduce_heads
200 '
201
202 test_expect_success 'can_all_from_reach:hit' '
@@ -219,7 +219,7 @@ test_expect_success 'can_all_from_reach:hit' '
219 Y:commit-8-1
220 EOF
221 echo "can_all_from_reach(X,Y):1" >expect &&
222 - test_three_modes can_all_from_reach
222 + test_all_modes can_all_from_reach
223 '
224
225 test_expect_success 'can_all_from_reach:miss' '
@@ -241,7 +241,7 @@ test_expect_success 'can_all_from_reach:miss' '
241 Y:commit-8-5
242 EOF
243 echo "can_all_from_reach(X,Y):0" >expect &&
244 - test_three_modes can_all_from_reach
244 + test_all_modes can_all_from_reach
245 '
246
247 test_expect_success 'can_all_from_reach_with_flag: tags case' '
@@ -264,7 +264,7 @@ test_expect_success 'can_all_from_reach_with_flag: tags case' '
264 Y:commit-8-1
265 EOF
266 echo "can_all_from_reach_with_flag(X,_,_,0,0):1" >expect &&
267 - test_three_modes can_all_from_reach_with_flag
267 + test_all_modes can_all_from_reach_with_flag
268 '
269
270 test_expect_success 'commit_contains:hit' '
@@ -280,8 +280,8 @@ test_expect_success 'commit_contains:hit' '
280 X:commit-9-3
281 EOF
282 echo "commit_contains(_,A,X,_):1" >expect &&
283 - test_three_modes commit_contains &&
284 - test_three_modes commit_contains --tag
283 + test_all_modes commit_contains &&
284 + test_all_modes commit_contains --tag
285 '
286
287 test_expect_success 'commit_contains:miss' '
@@ -297,8 +297,8 @@ test_expect_success 'commit_contains:miss' '
297 X:commit-9-3
298 EOF
299 echo "commit_contains(_,A,X,_):0" >expect &&
300 - test_three_modes commit_contains &&
301 - test_three_modes commit_contains --tag
300 + test_all_modes commit_contains &&
301 + test_all_modes commit_contains --tag
302 '
303
304 test_expect_success 'rev-list: basic topo-order' '
@@ -310,7 +310,7 @@ test_expect_success 'rev-list: basic topo-order' '
310 commit-6-2 commit-5-2 commit-4-2 commit-3-2 commit-2-2 commit-1-2 \
311 commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
312 >expect &&
313 - run_three_modes git rev-list --topo-order commit-6-6
313 + run_all_modes git rev-list --topo-order commit-6-6
314 '
315
316 test_expect_success 'rev-list: first-parent topo-order' '
@@ -322,7 +322,7 @@ test_expect_success 'rev-list: first-parent topo-order' '
322 commit-6-2 \
323 commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
324 >expect &&
325 - run_three_modes git rev-list --first-parent --topo-order commit-6-6
325 + run_all_modes git rev-list --first-parent --topo-order commit-6-6
326 '
327
328 test_expect_success 'rev-list: range topo-order' '
@@ -334,7 +334,7 @@ test_expect_success 'rev-list: range topo-order' '
334 commit-6-2 commit-5-2 commit-4-2 \
335 commit-6-1 commit-5-1 commit-4-1 \
336 >expect &&
337 - run_three_modes git rev-list --topo-order commit-3-3..commit-6-6
337 + run_all_modes git rev-list --topo-order commit-3-3..commit-6-6
338 '
339
340 test_expect_success 'rev-list: range topo-order' '
@@ -346,7 +346,7 @@ test_expect_success 'rev-list: range topo-order' '
346 commit-6-2 commit-5-2 commit-4-2 \
347 commit-6-1 commit-5-1 commit-4-1 \
348 >expect &&
349 - run_three_modes git rev-list --topo-order commit-3-8..commit-6-6
349 + run_all_modes git rev-list --topo-order commit-3-8..commit-6-6
350 '
351
352 test_expect_success 'rev-list: first-parent range topo-order' '
@@ -358,7 +358,7 @@ test_expect_success 'rev-list: first-parent range topo-order' '
358 commit-6-2 \
359 commit-6-1 commit-5-1 commit-4-1 \
360 >expect &&
361 - run_three_modes git rev-list --first-parent --topo-order commit-3-8..commit-6-6
361 + run_all_modes git rev-list --first-parent --topo-order commit-3-8..commit-6-6
362 '
363
364 test_expect_success 'rev-list: ancestry-path topo-order' '
@@ -368,7 +368,7 @@ test_expect_success 'rev-list: ancestry-path topo-order' '
368 commit-6-4 commit-5-4 commit-4-4 commit-3-4 \
369 commit-6-3 commit-5-3 commit-4-3 \
370 >expect &&
371 - run_three_modes git rev-list --topo-order --ancestry-path commit-3-3..commit-6-6
371 + run_all_modes git rev-list --topo-order --ancestry-path commit-3-3..commit-6-6
372 '
373
374 test_expect_success 'rev-list: symmetric difference topo-order' '
@@ -382,7 +382,7 @@ test_expect_success 'rev-list: symmetric difference topo-order' '
382 commit-3-8 commit-2-8 commit-1-8 \
383 commit-3-7 commit-2-7 commit-1-7 \
384 >expect &&
385 - run_three_modes git rev-list --topo-order commit-3-8...commit-6-6
385 + run_all_modes git rev-list --topo-order commit-3-8...commit-6-6
386 '
387
388 test_expect_success 'get_reachable_subset:all' '
@@ -402,7 +402,7 @@ test_expect_success 'get_reachable_subset:all' '
402 commit-1-7 \
403 commit-5-6 | sort
404 ) >expect &&
405 - test_three_modes get_reachable_subset
405 + test_all_modes get_reachable_subset
406 '
407
408 test_expect_success 'get_reachable_subset:some' '
@@ -420,7 +420,7 @@ test_expect_success 'get_reachable_subset:some' '
420 git rev-parse commit-3-3 \
421 commit-1-7 | sort
422 ) >expect &&
423 - test_three_modes get_reachable_subset
423 + test_all_modes get_reachable_subset
424 '
425
426 test_expect_success 'get_reachable_subset:none' '
@@ -434,7 +434,7 @@ test_expect_success 'get_reachable_subset:none' '
434 Y:commit-2-8
435 EOF
436 echo "get_reachable_subset(X,Y)" >expect &&
437 - test_three_modes get_reachable_subset
437 + test_all_modes get_reachable_subset
438 '
439
440 test_done