Merge branch 'jt/fetch-v2-sideband'
[gitweb.git] / t / helper / test-repository.c
index 2762ca656262baa9494d96a2647248f4042a2e01..f7f861844560e0578eda989e39c4bd0572dcd5d6 100644 (file)
@@ -15,7 +15,15 @@ static void test_parse_commit_in_graph(const char *gitdir, const char *worktree,
        struct commit *c;
        struct commit_list *parent;
 
-       repo_init(&r, gitdir, worktree);
+       setup_git_env(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");
 
        c = lookup_commit(&r, commit_oid);
 
@@ -38,7 +46,15 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
        struct commit *c;
        struct tree *tree;
 
-       repo_init(&r, gitdir, worktree);
+       setup_git_env(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");
 
        c = lookup_commit(&r, commit_oid);