aboutsummaryrefslogtreecommitdiffstats
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.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index 2762ca6562..56f0e3c1be 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -15,7 +15,14 @@ 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));
+
+ 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);
@@ -38,7 +45,14 @@ 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));
+
+ 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);
@@ -59,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")) {