test-read-cache: setup git dir

b1ef400e (setup_git_env: avoid blind fall-back to ".git") made programs
that tried to access a repository without initializing properly die with
a diagnostic message.  One offender is test-read-cache, which is used in
p0002.  Fix it by calling setup_git_directory() before accessing the
index.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2017-04-06 22:41:41 +02:00 committed by Junio C Hamano
parent 3e8b7d3c77
commit bccb22cbb1

View File

@ -5,6 +5,7 @@ int cmd_main(int argc, const char **argv)
int i, cnt = 1; int i, cnt = 1;
if (argc == 2) if (argc == 2)
cnt = strtol(argv[1], NULL, 0); cnt = strtol(argv[1], NULL, 0);
setup_git_directory();
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
read_cache(); read_cache();
discard_cache(); discard_cache();