summaryrefslogtreecommitdiff
path: root/t/helper/test-repository.c
diff options
context:
space:
mode:
Diffstat (limited to 't/helper/test-repository.c')
-rw-r--r--t/helper/test-repository.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index f7f8618445..56f0e3c1be 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -19,12 +19,11 @@ static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
memset(the_repository, 0, sizeof(*the_repository));
- /* TODO: Needed for temporary hack in hashcmp, see 183a638b7da. */
- repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
-
if (repo_init(&r, gitdir, worktree))
die("Couldn't init repo");
+ repo_set_hash_algo(the_repository, hash_algo_by_ptr(r.hash_algo));
+
c = lookup_commit(&r, commit_oid);
if (!parse_commit_in_graph(&r, c))
@@ -50,12 +49,11 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
memset(the_repository, 0, sizeof(*the_repository));
- /* TODO: Needed for temporary hack in hashcmp, see 183a638b7da. */
- repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
-
if (repo_init(&r, gitdir, worktree))
die("Couldn't init repo");
+ repo_set_hash_algo(the_repository, hash_algo_by_ptr(r.hash_algo));
+
c = lookup_commit(&r, commit_oid);
/*
@@ -75,6 +73,10 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
int cmd__repository(int argc, const char **argv)
{
+ int nongit_ok = 0;
+
+ setup_git_directory_gently(&nongit_ok);
+
if (argc < 2)
die("must have at least 2 arguments");
if (!strcmp(argv[1], "parse_commit_in_graph")) {