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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
Feb 22, 2020 at 20:17 UTC
8dca7f30e4e5da31b375ecaeeac995305c9c0c5c
1 file changed
+4
t/helper/test-repository.c
+4
@@ -75,6 +75,10 @@ static void test_get_commit_tree_in_graph(const char *gitdir,
75
76
int cmd__repository(int argc, const char **argv)
77
{
78
+ int nongit_ok = 0;
79
+
80
+ setup_git_directory_gently(&nongit_ok);
81
+
82
if (argc < 2)
83
die("must have at least 2 arguments");
84
if (!strcmp(argv[1], "parse_commit_in_graph")) {