summaryrefslogtreecommitdiff
path: root/t/t6600-test-reach.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/t6600-test-reach.sh')
-rwxr-xr-xt/t6600-test-reach.sh92
1 files changed, 64 insertions, 28 deletions
diff --git a/t/t6600-test-reach.sh b/t/t6600-test-reach.sh
index 475564b..3d7a62d 100755
--- a/t/t6600-test-reach.sh
+++ b/t/t6600-test-reach.sh
@@ -55,10 +55,13 @@ test_expect_success 'setup' '
git show-ref -s commit-5-5 | git commit-graph write --stdin-commits &&
mv .git/objects/info/commit-graph commit-graph-half &&
chmod u+w commit-graph-half &&
+ git -c commitGraph.generationVersion=1 commit-graph write --reachable &&
+ mv .git/objects/info/commit-graph commit-graph-no-gdat &&
+ chmod u+w commit-graph-no-gdat &&
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 &&
@@ -67,11 +70,14 @@ run_three_modes () {
test_cmp expect actual &&
cp commit-graph-half .git/objects/info/commit-graph &&
"$@" <input >actual &&
+ test_cmp expect actual &&
+ cp commit-graph-no-gdat .git/objects/info/commit-graph &&
+ "$@" <input >actual &&
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 +86,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 +95,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 +104,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 +113,37 @@ 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' '
+ cat >input <<-\EOF &&
+ A:commit-6-8
+ X:commit-6-9
+ X:commit-5-7
+ EOF
+ echo "in_merge_bases_many(A,X):1" >expect &&
+ test_all_modes in_merge_bases_many
+'
+
+test_expect_success 'in_merge_bases_many:miss' '
+ cat >input <<-\EOF &&
+ A:commit-6-8
+ X:commit-7-7
+ X:commit-8-6
+ EOF
+ echo "in_merge_bases_many(A,X):0" >expect &&
+ test_all_modes in_merge_bases_many
+'
+
+test_expect_success 'in_merge_bases_many:miss-heuristic' '
+ cat >input <<-\EOF &&
+ A:commit-6-8
+ X:commit-7-5
+ X:commit-6-6
+ EOF
+ echo "in_merge_bases_many(A,X):0" >expect &&
+ test_all_modes in_merge_bases_many
'
test_expect_success 'is_descendant_of:hit' '
@@ -118,7 +154,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' '
@@ -129,7 +165,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' '
@@ -144,7 +180,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' '
@@ -166,7 +202,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' '
@@ -189,7 +225,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' '
@@ -211,7 +247,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' '
@@ -234,7 +270,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' '
@@ -250,8 +286,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' '
@@ -267,8 +303,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' '
@@ -280,7 +316,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' '
@@ -292,7 +328,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' '
@@ -304,7 +340,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' '
@@ -316,7 +352,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' '
@@ -328,7 +364,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' '
@@ -338,7 +374,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' '
@@ -352,7 +388,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' '
@@ -372,7 +408,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' '
@@ -390,7 +426,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' '
@@ -404,7 +440,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