git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test-read-cache: setup git dir

From
René Scharfe <l.s.r@web.de>
Date
Apr 6, 2017, 20:41 UTC
Message-ID
<020feb89-be3e-1261-d9b5-cad7c38ef2f0@web.de>

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>
---
 t/helper/test-read-cache.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index 2a7990efc3..48255eef31 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -5,6 +5,7 @@ int cmd_main(int argc, const char **argv)
 	int i, cnt = 1;
 	if (argc == 2)
 		cnt = strtol(argv[1], NULL, 0);
+	setup_git_directory();
 	for (i = 0; i < cnt; i++) {
 		read_cache();
 		discard_cache();
-- 
2.12.2
Next: Jeff King
Message 1 of 2 in “test-read-cache: setup git dir”
  1. test-read-cache: setup git dirRené Scharfe, Apr 6, 2017
  2. Jeff KingApr 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.