Skip to content

Commit 8dca7f3

Browse files
bk2204gitster
authored andcommitted
t/helper: initialize repository if necessary
The repository helper is used in t5318 to read commit graphs whether we're in a repository or not. However, without a repository, we have no way to properly initialize the hash algorithm, meaning that the file is misread. Fix this by calling setup_git_directory_gently, which will read the environment variable the testsuite sets to ensure that the correct hash algorithm is set. Signed-off-by: brian m. carlson <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6946e52 commit 8dca7f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

t/helper/test-repository.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
7575

7676
int cmd__repository(int argc, const char **argv)
7777
{
78+
int nongit_ok = 0;
79+
80+
setup_git_directory_gently(&nongit_ok);
81+
7882
if (argc < 2)
7983
die("must have at least 2 arguments");
8084
if (!strcmp(argv[1], "parse_commit_in_graph")) {

0 commit comments

Comments
 (0)