Skip to content

Commit c0ef139

Browse files
abhishekkumar2718gitster
authored andcommitted
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 <[email protected]> Reviewed-by: Taylor Blau <[email protected]> Reviewed-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f90fca6 commit c0ef139

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

t/t6600-test-reach.sh

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test_expect_success 'setup' '
5858
git config core.commitGraph true
5959
'
6060

61-
run_three_modes () {
61+
run_all_modes () {
6262
test_when_finished rm -rf .git/objects/info/commit-graph &&
6363
"$@" <input >actual &&
6464
test_cmp expect actual &&
@@ -70,8 +70,8 @@ run_three_modes () {
7070
test_cmp expect actual
7171
}
7272

73-
test_three_modes () {
74-
run_three_modes test-tool reach "$@"
73+
test_all_modes () {
74+
run_all_modes test-tool reach "$@"
7575
}
7676

7777
test_expect_success 'ref_newer:miss' '
@@ -80,7 +80,7 @@ test_expect_success 'ref_newer:miss' '
8080
B:commit-4-9
8181
EOF
8282
echo "ref_newer(A,B):0" >expect &&
83-
test_three_modes ref_newer
83+
test_all_modes ref_newer
8484
'
8585

8686
test_expect_success 'ref_newer:hit' '
@@ -89,7 +89,7 @@ test_expect_success 'ref_newer:hit' '
8989
B:commit-2-3
9090
EOF
9191
echo "ref_newer(A,B):1" >expect &&
92-
test_three_modes ref_newer
92+
test_all_modes ref_newer
9393
'
9494

9595
test_expect_success 'in_merge_bases:hit' '
@@ -98,7 +98,7 @@ test_expect_success 'in_merge_bases:hit' '
9898
B:commit-8-8
9999
EOF
100100
echo "in_merge_bases(A,B):1" >expect &&
101-
test_three_modes in_merge_bases
101+
test_all_modes in_merge_bases
102102
'
103103

104104
test_expect_success 'in_merge_bases:miss' '
@@ -107,7 +107,7 @@ test_expect_success 'in_merge_bases:miss' '
107107
B:commit-5-9
108108
EOF
109109
echo "in_merge_bases(A,B):0" >expect &&
110-
test_three_modes in_merge_bases
110+
test_all_modes in_merge_bases
111111
'
112112

113113
test_expect_success 'in_merge_bases_many:hit' '
@@ -117,7 +117,7 @@ test_expect_success 'in_merge_bases_many:hit' '
117117
X:commit-5-7
118118
EOF
119119
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
121121
'
122122

123123
test_expect_success 'in_merge_bases_many:miss' '
@@ -127,7 +127,7 @@ test_expect_success 'in_merge_bases_many:miss' '
127127
X:commit-8-6
128128
EOF
129129
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
131131
'
132132

133133
test_expect_success 'in_merge_bases_many:miss-heuristic' '
@@ -137,7 +137,7 @@ test_expect_success 'in_merge_bases_many:miss-heuristic' '
137137
X:commit-6-6
138138
EOF
139139
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
141141
'
142142

143143
test_expect_success 'is_descendant_of:hit' '
@@ -148,7 +148,7 @@ test_expect_success 'is_descendant_of:hit' '
148148
X:commit-1-1
149149
EOF
150150
echo "is_descendant_of(A,X):1" >expect &&
151-
test_three_modes is_descendant_of
151+
test_all_modes is_descendant_of
152152
'
153153

154154
test_expect_success 'is_descendant_of:miss' '
@@ -159,7 +159,7 @@ test_expect_success 'is_descendant_of:miss' '
159159
X:commit-7-6
160160
EOF
161161
echo "is_descendant_of(A,X):0" >expect &&
162-
test_three_modes is_descendant_of
162+
test_all_modes is_descendant_of
163163
'
164164

165165
test_expect_success 'get_merge_bases_many' '
@@ -174,7 +174,7 @@ test_expect_success 'get_merge_bases_many' '
174174
git rev-parse commit-5-6 \
175175
commit-4-7 | sort
176176
} >expect &&
177-
test_three_modes get_merge_bases_many
177+
test_all_modes get_merge_bases_many
178178
'
179179

180180
test_expect_success 'reduce_heads' '
@@ -196,7 +196,7 @@ test_expect_success 'reduce_heads' '
196196
commit-2-8 \
197197
commit-1-10 | sort
198198
} >expect &&
199-
test_three_modes reduce_heads
199+
test_all_modes reduce_heads
200200
'
201201

202202
test_expect_success 'can_all_from_reach:hit' '
@@ -219,7 +219,7 @@ test_expect_success 'can_all_from_reach:hit' '
219219
Y:commit-8-1
220220
EOF
221221
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
223223
'
224224

225225
test_expect_success 'can_all_from_reach:miss' '
@@ -241,7 +241,7 @@ test_expect_success 'can_all_from_reach:miss' '
241241
Y:commit-8-5
242242
EOF
243243
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
245245
'
246246

247247
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' '
264264
Y:commit-8-1
265265
EOF
266266
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
268268
'
269269

270270
test_expect_success 'commit_contains:hit' '
@@ -280,8 +280,8 @@ test_expect_success 'commit_contains:hit' '
280280
X:commit-9-3
281281
EOF
282282
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
285285
'
286286

287287
test_expect_success 'commit_contains:miss' '
@@ -297,8 +297,8 @@ test_expect_success 'commit_contains:miss' '
297297
X:commit-9-3
298298
EOF
299299
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
302302
'
303303

304304
test_expect_success 'rev-list: basic topo-order' '
@@ -310,7 +310,7 @@ test_expect_success 'rev-list: basic topo-order' '
310310
commit-6-2 commit-5-2 commit-4-2 commit-3-2 commit-2-2 commit-1-2 \
311311
commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
312312
>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
314314
'
315315

316316
test_expect_success 'rev-list: first-parent topo-order' '
@@ -322,7 +322,7 @@ test_expect_success 'rev-list: first-parent topo-order' '
322322
commit-6-2 \
323323
commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
324324
>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
326326
'
327327

328328
test_expect_success 'rev-list: range topo-order' '
@@ -334,7 +334,7 @@ test_expect_success 'rev-list: range topo-order' '
334334
commit-6-2 commit-5-2 commit-4-2 \
335335
commit-6-1 commit-5-1 commit-4-1 \
336336
>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
338338
'
339339

340340
test_expect_success 'rev-list: range topo-order' '
@@ -346,7 +346,7 @@ test_expect_success 'rev-list: range topo-order' '
346346
commit-6-2 commit-5-2 commit-4-2 \
347347
commit-6-1 commit-5-1 commit-4-1 \
348348
>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
350350
'
351351

352352
test_expect_success 'rev-list: first-parent range topo-order' '
@@ -358,7 +358,7 @@ test_expect_success 'rev-list: first-parent range topo-order' '
358358
commit-6-2 \
359359
commit-6-1 commit-5-1 commit-4-1 \
360360
>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
362362
'
363363

364364
test_expect_success 'rev-list: ancestry-path topo-order' '
@@ -368,7 +368,7 @@ test_expect_success 'rev-list: ancestry-path topo-order' '
368368
commit-6-4 commit-5-4 commit-4-4 commit-3-4 \
369369
commit-6-3 commit-5-3 commit-4-3 \
370370
>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
372372
'
373373

374374
test_expect_success 'rev-list: symmetric difference topo-order' '
@@ -382,7 +382,7 @@ test_expect_success 'rev-list: symmetric difference topo-order' '
382382
commit-3-8 commit-2-8 commit-1-8 \
383383
commit-3-7 commit-2-7 commit-1-7 \
384384
>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
386386
'
387387

388388
test_expect_success 'get_reachable_subset:all' '
@@ -402,7 +402,7 @@ test_expect_success 'get_reachable_subset:all' '
402402
commit-1-7 \
403403
commit-5-6 | sort
404404
) >expect &&
405-
test_three_modes get_reachable_subset
405+
test_all_modes get_reachable_subset
406406
'
407407

408408
test_expect_success 'get_reachable_subset:some' '
@@ -420,7 +420,7 @@ test_expect_success 'get_reachable_subset:some' '
420420
git rev-parse commit-3-3 \
421421
commit-1-7 | sort
422422
) >expect &&
423-
test_three_modes get_reachable_subset
423+
test_all_modes get_reachable_subset
424424
'
425425

426426
test_expect_success 'get_reachable_subset:none' '
@@ -434,7 +434,7 @@ test_expect_success 'get_reachable_subset:none' '
434434
Y:commit-2-8
435435
EOF
436436
echo "get_reachable_subset(X,Y)" >expect &&
437-
test_three_modes get_reachable_subset
437+
test_all_modes get_reachable_subset
438438
'
439439

440440
test_done

0 commit comments

Comments
 (0)