Skip to content

Commit 4ce742f

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f0056f6 commit 4ce742f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

t/helper/test-dump-cache-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ int cmd_main(int ac, const char **av)
5858
{
5959
struct index_state istate;
6060
struct cache_tree *another = cache_tree();
61+
setup_git_directory();
6162
if (read_cache() < 0)
6263
die("unable to read index file");
6364
istate = the_index;

t/helper/test-scrap-cache-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ static struct lock_file index_lock;
77

88
int cmd_main(int ac, const char **av)
99
{
10+
setup_git_directory();
1011
hold_locked_index(&index_lock, 1);
1112
if (read_cache() < 0)
1213
die("unable to read index file");

0 commit comments

Comments
 (0)