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>
This commit is contained in:
Abhishek Kumar 2021-01-16 18:11:11 +00:00 коммит произвёл Junio C Hamano
Родитель f90fca638e
Коммит c0ef139843
1 изменённых файлов: 31 добавлений и 31 удалений

Просмотреть файл

@ -58,7 +58,7 @@ test_expect_success 'setup' '
git config core.commitGraph true
'
run_three_modes () {
run_all_modes () {
test_when_finished rm -rf .git/objects/info/commit-graph &&
"$@" <input >actual &&
test_cmp expect actual &&
@ -70,8 +70,8 @@ run_three_modes () {
test_cmp expect actual
}
test_three_modes () {
run_three_modes test-tool reach "$@"
test_all_modes () {
run_all_modes test-tool reach "$@"
}
test_expect_success 'ref_newer:miss' '
@ -80,7 +80,7 @@ test_expect_success 'ref_newer:miss' '
B:commit-4-9
EOF
echo "ref_newer(A,B):0" >expect &&
test_three_modes ref_newer
test_all_modes ref_newer
'
test_expect_success 'ref_newer:hit' '
@ -89,7 +89,7 @@ test_expect_success 'ref_newer:hit' '
B:commit-2-3
EOF
echo "ref_newer(A,B):1" >expect &&
test_three_modes ref_newer
test_all_modes ref_newer
'
test_expect_success 'in_merge_bases:hit' '
@ -98,7 +98,7 @@ test_expect_success 'in_merge_bases:hit' '
B:commit-8-8
EOF
echo "in_merge_bases(A,B):1" >expect &&
test_three_modes in_merge_bases
test_all_modes in_merge_bases
'
test_expect_success 'in_merge_bases:miss' '
@ -107,7 +107,7 @@ test_expect_success 'in_merge_bases:miss' '
B:commit-5-9
EOF
echo "in_merge_bases(A,B):0" >expect &&
test_three_modes in_merge_bases
test_all_modes in_merge_bases
'
test_expect_success 'in_merge_bases_many:hit' '
@ -117,7 +117,7 @@ test_expect_success 'in_merge_bases_many:hit' '
X:commit-5-7
EOF
echo "in_merge_bases_many(A,X):1" >expect &&
test_three_modes in_merge_bases_many
test_all_modes in_merge_bases_many
'
test_expect_success 'in_merge_bases_many:miss' '
@ -127,7 +127,7 @@ test_expect_success 'in_merge_bases_many:miss' '
X:commit-8-6
EOF
echo "in_merge_bases_many(A,X):0" >expect &&
test_three_modes in_merge_bases_many
test_all_modes in_merge_bases_many
'
test_expect_success 'in_merge_bases_many:miss-heuristic' '
@ -137,7 +137,7 @@ test_expect_success 'in_merge_bases_many:miss-heuristic' '
X:commit-6-6
EOF
echo "in_merge_bases_many(A,X):0" >expect &&
test_three_modes in_merge_bases_many
test_all_modes in_merge_bases_many
'
test_expect_success 'is_descendant_of:hit' '
@ -148,7 +148,7 @@ test_expect_success 'is_descendant_of:hit' '
X:commit-1-1
EOF
echo "is_descendant_of(A,X):1" >expect &&
test_three_modes is_descendant_of
test_all_modes is_descendant_of
'
test_expect_success 'is_descendant_of:miss' '
@ -159,7 +159,7 @@ test_expect_success 'is_descendant_of:miss' '
X:commit-7-6
EOF
echo "is_descendant_of(A,X):0" >expect &&
test_three_modes is_descendant_of
test_all_modes is_descendant_of
'
test_expect_success 'get_merge_bases_many' '
@ -174,7 +174,7 @@ test_expect_success 'get_merge_bases_many' '
git rev-parse commit-5-6 \
commit-4-7 | sort
} >expect &&
test_three_modes get_merge_bases_many
test_all_modes get_merge_bases_many
'
test_expect_success 'reduce_heads' '
@ -196,7 +196,7 @@ test_expect_success 'reduce_heads' '
commit-2-8 \
commit-1-10 | sort
} >expect &&
test_three_modes reduce_heads
test_all_modes reduce_heads
'
test_expect_success 'can_all_from_reach:hit' '
@ -219,7 +219,7 @@ test_expect_success 'can_all_from_reach:hit' '
Y:commit-8-1
EOF
echo "can_all_from_reach(X,Y):1" >expect &&
test_three_modes can_all_from_reach
test_all_modes can_all_from_reach
'
test_expect_success 'can_all_from_reach:miss' '
@ -241,7 +241,7 @@ test_expect_success 'can_all_from_reach:miss' '
Y:commit-8-5
EOF
echo "can_all_from_reach(X,Y):0" >expect &&
test_three_modes can_all_from_reach
test_all_modes can_all_from_reach
'
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' '
Y:commit-8-1
EOF
echo "can_all_from_reach_with_flag(X,_,_,0,0):1" >expect &&
test_three_modes can_all_from_reach_with_flag
test_all_modes can_all_from_reach_with_flag
'
test_expect_success 'commit_contains:hit' '
@ -280,8 +280,8 @@ test_expect_success 'commit_contains:hit' '
X:commit-9-3
EOF
echo "commit_contains(_,A,X,_):1" >expect &&
test_three_modes commit_contains &&
test_three_modes commit_contains --tag
test_all_modes commit_contains &&
test_all_modes commit_contains --tag
'
test_expect_success 'commit_contains:miss' '
@ -297,8 +297,8 @@ test_expect_success 'commit_contains:miss' '
X:commit-9-3
EOF
echo "commit_contains(_,A,X,_):0" >expect &&
test_three_modes commit_contains &&
test_three_modes commit_contains --tag
test_all_modes commit_contains &&
test_all_modes commit_contains --tag
'
test_expect_success 'rev-list: basic topo-order' '
@ -310,7 +310,7 @@ test_expect_success 'rev-list: basic topo-order' '
commit-6-2 commit-5-2 commit-4-2 commit-3-2 commit-2-2 commit-1-2 \
commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
>expect &&
run_three_modes git rev-list --topo-order commit-6-6
run_all_modes git rev-list --topo-order commit-6-6
'
test_expect_success 'rev-list: first-parent topo-order' '
@ -322,7 +322,7 @@ test_expect_success 'rev-list: first-parent topo-order' '
commit-6-2 \
commit-6-1 commit-5-1 commit-4-1 commit-3-1 commit-2-1 commit-1-1 \
>expect &&
run_three_modes git rev-list --first-parent --topo-order commit-6-6
run_all_modes git rev-list --first-parent --topo-order commit-6-6
'
test_expect_success 'rev-list: range topo-order' '
@ -334,7 +334,7 @@ test_expect_success 'rev-list: range topo-order' '
commit-6-2 commit-5-2 commit-4-2 \
commit-6-1 commit-5-1 commit-4-1 \
>expect &&
run_three_modes git rev-list --topo-order commit-3-3..commit-6-6
run_all_modes git rev-list --topo-order commit-3-3..commit-6-6
'
test_expect_success 'rev-list: range topo-order' '
@ -346,7 +346,7 @@ test_expect_success 'rev-list: range topo-order' '
commit-6-2 commit-5-2 commit-4-2 \
commit-6-1 commit-5-1 commit-4-1 \
>expect &&
run_three_modes git rev-list --topo-order commit-3-8..commit-6-6
run_all_modes git rev-list --topo-order commit-3-8..commit-6-6
'
test_expect_success 'rev-list: first-parent range topo-order' '
@ -358,7 +358,7 @@ test_expect_success 'rev-list: first-parent range topo-order' '
commit-6-2 \
commit-6-1 commit-5-1 commit-4-1 \
>expect &&
run_three_modes git rev-list --first-parent --topo-order commit-3-8..commit-6-6
run_all_modes git rev-list --first-parent --topo-order commit-3-8..commit-6-6
'
test_expect_success 'rev-list: ancestry-path topo-order' '
@ -368,7 +368,7 @@ test_expect_success 'rev-list: ancestry-path topo-order' '
commit-6-4 commit-5-4 commit-4-4 commit-3-4 \
commit-6-3 commit-5-3 commit-4-3 \
>expect &&
run_three_modes git rev-list --topo-order --ancestry-path commit-3-3..commit-6-6
run_all_modes git rev-list --topo-order --ancestry-path commit-3-3..commit-6-6
'
test_expect_success 'rev-list: symmetric difference topo-order' '
@ -382,7 +382,7 @@ test_expect_success 'rev-list: symmetric difference topo-order' '
commit-3-8 commit-2-8 commit-1-8 \
commit-3-7 commit-2-7 commit-1-7 \
>expect &&
run_three_modes git rev-list --topo-order commit-3-8...commit-6-6
run_all_modes git rev-list --topo-order commit-3-8...commit-6-6
'
test_expect_success 'get_reachable_subset:all' '
@ -402,7 +402,7 @@ test_expect_success 'get_reachable_subset:all' '
commit-1-7 \
commit-5-6 | sort
) >expect &&
test_three_modes get_reachable_subset
test_all_modes get_reachable_subset
'
test_expect_success 'get_reachable_subset:some' '
@ -420,7 +420,7 @@ test_expect_success 'get_reachable_subset:some' '
git rev-parse commit-3-3 \
commit-1-7 | sort
) >expect &&
test_three_modes get_reachable_subset
test_all_modes get_reachable_subset
'
test_expect_success 'get_reachable_subset:none' '
@ -434,7 +434,7 @@ test_expect_success 'get_reachable_subset:none' '
Y:commit-2-8
EOF
echo "get_reachable_subset(X,Y)" >expect &&
test_three_modes get_reachable_subset
test_all_modes get_reachable_subset
'
test_done