summaryrefslogtreecommitdiffstats
path: root/t/helper/test-repository.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2020-02-22 21:17:35 +0100
committerJunio C Hamano <gitster@pobox.com>2020-02-24 18:33:27 +0100
commit8dca7f30e4e5da31b375ecaeeac995305c9c0c5c (patch)
tree346e2ede1e211f37e78fe207af345f78639d88ef /t/helper/test-repository.c
parentt/helper/test-dump-split-index: initialize git repository (diff)
downloadgit-8dca7f30e4e5da31b375ecaeeac995305c9c0c5c.tar.xz
git-8dca7f30e4e5da31b375ecaeeac995305c9c0c5c.zip
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>
Diffstat (limited to 't/helper/test-repository.c')
-rw-r--r--t/helper/test-repository.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/helper/test-repository.c b/t/helper/test-repository.c
index f7f8618445..ecc768e4cb 100644
--- a/t/helper/test-repository.c
+++ b/t/helper/test-repository.c
@@ -75,6 +75,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")) {