From: Jeff King Date: Thu, 20 Oct 2016 06:16:59 +0000 (-0400) Subject: test-*-cache-tree: setup git dir X-Git-Tag: v2.11.0-rc0~21^2~4 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4ce742fc9c09cd3b95be309bc093f8fa54c15f96;p=git-core%2Fgit.git test-*-cache-tree: setup git dir These test helper programs access the index, but do not ever setup_git_directory(), meaning we just blindly looked in ".git/index". This happened to work for the purposes of our tests (which do not run from subdirectories, nor in non-repos), but it's a bad habit. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c index 44f329025..7af116d49 100644 --- a/t/helper/test-dump-cache-tree.c +++ b/t/helper/test-dump-cache-tree.c @@ -58,6 +58,7 @@ int cmd_main(int ac, const char **av) { struct index_state istate; struct cache_tree *another = cache_tree(); + setup_git_directory(); if (read_cache() < 0) die("unable to read index file"); istate = the_index; diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c index 5b2fd0990..27fe0405b 100644 --- a/t/helper/test-scrap-cache-tree.c +++ b/t/helper/test-scrap-cache-tree.c @@ -7,6 +7,7 @@ static struct lock_file index_lock; int cmd_main(int ac, const char **av) { + setup_git_directory(); hold_locked_index(&index_lock, 1); if (read_cache() < 0) die("unable to read index file");