format-patch: inform user that patch-id generation is unstable
[gitweb.git] / t / t6600-test-reach.sh
index ae94b27f70c11dc18c2d5b29fd4d5c211c1eecee..b24d85003606bf2076902d944fb395bf55761d5a 100755 (executable)
@@ -56,18 +56,22 @@ test_expect_success 'setup' '
        git config core.commitGraph true
 '
 
-test_three_modes () {
+run_three_modes () {
        test_when_finished rm -rf .git/objects/info/commit-graph &&
-       test-tool reach $1 <input >actual &&
+       "$@" <input >actual &&
        test_cmp expect actual &&
        cp commit-graph-full .git/objects/info/commit-graph &&
-       test-tool reach $1 <input >actual &&
+       "$@" <input >actual &&
        test_cmp expect actual &&
        cp commit-graph-half .git/objects/info/commit-graph &&
-       test-tool reach $1 <input >actual &&
+       "$@" <input >actual &&
        test_cmp expect actual
 }
 
+test_three_modes () {
+       run_three_modes test-tool reach "$@"
+}
+
 test_expect_success 'ref_newer:miss' '
        cat >input <<-\EOF &&
        A:commit-5-7
@@ -265,4 +269,140 @@ test_expect_success 'commit_contains:miss' '
        test_three_modes commit_contains --tag
 '
 
+test_expect_success 'rev-list: basic topo-order' '
+       git rev-parse \
+               commit-6-6 commit-5-6 commit-4-6 commit-3-6 commit-2-6 commit-1-6 \
+               commit-6-5 commit-5-5 commit-4-5 commit-3-5 commit-2-5 commit-1-5 \
+               commit-6-4 commit-5-4 commit-4-4 commit-3-4 commit-2-4 commit-1-4 \
+               commit-6-3 commit-5-3 commit-4-3 commit-3-3 commit-2-3 commit-1-3 \
+               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
+'
+
+test_expect_success 'rev-list: first-parent topo-order' '
+       git rev-parse \
+               commit-6-6 \
+               commit-6-5 \
+               commit-6-4 \
+               commit-6-3 \
+               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
+'
+
+test_expect_success 'rev-list: range topo-order' '
+       git rev-parse \
+               commit-6-6 commit-5-6 commit-4-6 commit-3-6 commit-2-6 commit-1-6 \
+               commit-6-5 commit-5-5 commit-4-5 commit-3-5 commit-2-5 commit-1-5 \
+               commit-6-4 commit-5-4 commit-4-4 commit-3-4 commit-2-4 commit-1-4 \
+               commit-6-3 commit-5-3 commit-4-3 \
+               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
+'
+
+test_expect_success 'rev-list: range topo-order' '
+       git rev-parse \
+               commit-6-6 commit-5-6 commit-4-6 \
+               commit-6-5 commit-5-5 commit-4-5 \
+               commit-6-4 commit-5-4 commit-4-4 \
+               commit-6-3 commit-5-3 commit-4-3 \
+               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
+'
+
+test_expect_success 'rev-list: first-parent range topo-order' '
+       git rev-parse \
+               commit-6-6 \
+               commit-6-5 \
+               commit-6-4 \
+               commit-6-3 \
+               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
+'
+
+test_expect_success 'rev-list: ancestry-path topo-order' '
+       git rev-parse \
+               commit-6-6 commit-5-6 commit-4-6 commit-3-6 \
+               commit-6-5 commit-5-5 commit-4-5 commit-3-5 \
+               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
+'
+
+test_expect_success 'rev-list: symmetric difference topo-order' '
+       git rev-parse \
+               commit-6-6 commit-5-6 commit-4-6 \
+               commit-6-5 commit-5-5 commit-4-5 \
+               commit-6-4 commit-5-4 commit-4-4 \
+               commit-6-3 commit-5-3 commit-4-3 \
+               commit-6-2 commit-5-2 commit-4-2 \
+               commit-6-1 commit-5-1 commit-4-1 \
+               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
+'
+
+test_expect_success 'get_reachable_subset:all' '
+       cat >input <<-\EOF &&
+       X:commit-9-1
+       X:commit-8-3
+       X:commit-7-5
+       X:commit-6-6
+       X:commit-1-7
+       Y:commit-3-3
+       Y:commit-1-7
+       Y:commit-5-6
+       EOF
+       (
+               echo "get_reachable_subset(X,Y)" &&
+               git rev-parse commit-3-3 \
+                             commit-1-7 \
+                             commit-5-6 | sort
+       ) >expect &&
+       test_three_modes get_reachable_subset
+'
+
+test_expect_success 'get_reachable_subset:some' '
+       cat >input <<-\EOF &&
+       X:commit-9-1
+       X:commit-8-3
+       X:commit-7-5
+       X:commit-1-7
+       Y:commit-3-3
+       Y:commit-1-7
+       Y:commit-5-6
+       EOF
+       (
+               echo "get_reachable_subset(X,Y)" &&
+               git rev-parse commit-3-3 \
+                             commit-1-7 | sort
+       ) >expect &&
+       test_three_modes get_reachable_subset
+'
+
+test_expect_success 'get_reachable_subset:none' '
+       cat >input <<-\EOF &&
+       X:commit-9-1
+       X:commit-8-3
+       X:commit-7-5
+       X:commit-1-7
+       Y:commit-9-3
+       Y:commit-7-6
+       Y:commit-2-8
+       EOF
+       echo "get_reachable_subset(X,Y)" >expect &&
+       test_three_modes get_reachable_subset
+'
+
 test_done