t7501: rename commit test to comply with naming convention
[gitweb.git] / t / t6600-test-reach.sh
index 98bcb17960ee5c56da8d44a36bc76b2c5aa97df4..ae94b27f70c11dc18c2d5b29fd4d5c211c1eecee 100755 (executable)
@@ -31,7 +31,8 @@ test_expect_success 'setup' '
        for i in $(test_seq 1 10)
        do
                test_commit "1-$i" &&
-               git branch -f commit-1-$i
+               git branch -f commit-1-$i &&
+               git tag -a -m "1-$i" tag-1-$i commit-1-$i
        done &&
        for j in $(test_seq 1 9)
        do
@@ -39,11 +40,13 @@ test_expect_success 'setup' '
                x=$(($j + 1)) &&
                test_commit "$x-1" &&
                git branch -f commit-$x-1 &&
+               git tag -a -m "$x-1" tag-$x-1 commit-$x-1 &&
 
                for i in $(test_seq 2 10)
                do
                        git merge commit-$j-$i -m "$x-$i" &&
-                       git branch -f commit-$x-$i
+                       git branch -f commit-$x-$i &&
+                       git tag -a -m "$x-$i" tag-$x-$i commit-$x-$i
                done
        done &&
        git commit-graph write --reachable &&
@@ -123,4 +126,143 @@ test_expect_success 'is_descendant_of:miss' '
        test_three_modes is_descendant_of
 '
 
+test_expect_success 'get_merge_bases_many' '
+       cat >input <<-\EOF &&
+       A:commit-5-7
+       X:commit-4-8
+       X:commit-6-6
+       X:commit-8-3
+       EOF
+       {
+               echo "get_merge_bases_many(A,X):" &&
+               git rev-parse commit-5-6 \
+                             commit-4-7 | sort
+       } >expect &&
+       test_three_modes get_merge_bases_many
+'
+
+test_expect_success 'reduce_heads' '
+       cat >input <<-\EOF &&
+       X:commit-1-10
+       X:commit-2-8
+       X:commit-3-6
+       X:commit-4-4
+       X:commit-1-7
+       X:commit-2-5
+       X:commit-3-3
+       X:commit-5-1
+       EOF
+       {
+               echo "reduce_heads(X):" &&
+               git rev-parse commit-5-1 \
+                             commit-4-4 \
+                             commit-3-6 \
+                             commit-2-8 \
+                             commit-1-10 | sort
+       } >expect &&
+       test_three_modes reduce_heads
+'
+
+test_expect_success 'can_all_from_reach:hit' '
+       cat >input <<-\EOF &&
+       X:commit-2-10
+       X:commit-3-9
+       X:commit-4-8
+       X:commit-5-7
+       X:commit-6-6
+       X:commit-7-5
+       X:commit-8-4
+       X:commit-9-3
+       Y:commit-1-9
+       Y:commit-2-8
+       Y:commit-3-7
+       Y:commit-4-6
+       Y:commit-5-5
+       Y:commit-6-4
+       Y:commit-7-3
+       Y:commit-8-1
+       EOF
+       echo "can_all_from_reach(X,Y):1" >expect &&
+       test_three_modes can_all_from_reach
+'
+
+test_expect_success 'can_all_from_reach:miss' '
+       cat >input <<-\EOF &&
+       X:commit-2-10
+       X:commit-3-9
+       X:commit-4-8
+       X:commit-5-7
+       X:commit-6-6
+       X:commit-7-5
+       X:commit-8-4
+       X:commit-9-3
+       Y:commit-1-9
+       Y:commit-2-8
+       Y:commit-3-7
+       Y:commit-4-6
+       Y:commit-5-5
+       Y:commit-6-4
+       Y:commit-8-5
+       EOF
+       echo "can_all_from_reach(X,Y):0" >expect &&
+       test_three_modes can_all_from_reach
+'
+
+test_expect_success 'can_all_from_reach_with_flag: tags case' '
+       cat >input <<-\EOF &&
+       X:tag-2-10
+       X:tag-3-9
+       X:tag-4-8
+       X:commit-5-7
+       X:commit-6-6
+       X:commit-7-5
+       X:commit-8-4
+       X:commit-9-3
+       Y:tag-1-9
+       Y:tag-2-8
+       Y:tag-3-7
+       Y:commit-4-6
+       Y:commit-5-5
+       Y:commit-6-4
+       Y:commit-7-3
+       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_expect_success 'commit_contains:hit' '
+       cat >input <<-\EOF &&
+       A:commit-7-7
+       X:commit-2-10
+       X:commit-3-9
+       X:commit-4-8
+       X:commit-5-7
+       X:commit-6-6
+       X:commit-7-5
+       X:commit-8-4
+       X:commit-9-3
+       EOF
+       echo "commit_contains(_,A,X,_):1" >expect &&
+       test_three_modes commit_contains &&
+       test_three_modes commit_contains --tag
+'
+
+test_expect_success 'commit_contains:miss' '
+       cat >input <<-\EOF &&
+       A:commit-6-5
+       X:commit-2-10
+       X:commit-3-9
+       X:commit-4-8
+       X:commit-5-7
+       X:commit-6-6
+       X:commit-7-5
+       X:commit-8-4
+       X:commit-9-3
+       EOF
+       echo "commit_contains(_,A,X,_):0" >expect &&
+       test_three_modes commit_contains &&
+       test_three_modes commit_contains --tag
+'
+
 test_done