Merge branch 'jh/partial-clone-doc'
[gitweb.git] / t / t5318-commit-graph.sh
index 04516d64650c1c3e71a64c6612754e7ad0333e7b..3c1ffad49144d177a56f2f6a0b26612899e25adb 100755 (executable)
@@ -431,4 +431,41 @@ test_expect_success 'git fsck (checks commit-graph)' '
        test_must_fail git fsck
 '
 
+test_expect_success 'setup non-the_repository tests' '
+       rm -rf repo &&
+       git init repo &&
+       test_commit -C repo one &&
+       test_commit -C repo two &&
+       git -C repo config core.commitGraph true &&
+       git -C repo rev-parse two | \
+               git -C repo commit-graph write --stdin-commits
+'
+
+test_expect_success 'parse_commit_in_graph works for non-the_repository' '
+       test-tool repository parse_commit_in_graph \
+               repo/.git repo "$(git -C repo rev-parse two)" >actual &&
+       {
+               git -C repo log --pretty=format:"%ct " -1 &&
+               git -C repo rev-parse one
+       } >expect &&
+       test_cmp expect actual &&
+
+       test-tool repository parse_commit_in_graph \
+               repo/.git repo "$(git -C repo rev-parse one)" >actual &&
+       git -C repo log --pretty="%ct" -1 one >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'get_commit_tree_in_graph works for non-the_repository' '
+       test-tool repository get_commit_tree_in_graph \
+               repo/.git repo "$(git -C repo rev-parse two)" >actual &&
+       git -C repo rev-parse two^{tree} >expect &&
+       test_cmp expect actual &&
+
+       test-tool repository get_commit_tree_in_graph \
+               repo/.git repo "$(git -C repo rev-parse one)" >actual &&
+       git -C repo rev-parse one^{tree} >expect &&
+       test_cmp expect actual
+'
+
 test_done