]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-scrap-cache-tree.c
t/helper: stop using `the_index`
[thirdparty/git.git] / t / helper / test-scrap-cache-tree.c
CommitLineData
ff5fb8b0 1#include "test-tool.h"
697cc8ef 2#include "lockfile.h"
08c46a49 3#include "read-cache-ll.h"
d1cbe1e6 4#include "repository.h"
e38da487 5#include "setup.h"
1aed2fe3
TR
6#include "tree.h"
7#include "cache-tree.h"
8
126e3b3d 9int cmd__scrap_cache_tree(int ac UNUSED, const char **av UNUSED)
1aed2fe3 10{
0fa5a2ed
11 struct lock_file index_lock = LOCK_INIT;
12
4ce742fc 13 setup_git_directory();
0ea414a1
ÆAB
14 repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR);
15 if (repo_read_index(the_repository) < 0)
1aed2fe3 16 die("unable to read index file");
319ba144
PS
17 cache_tree_free(&the_repository->index->cache_tree);
18 the_repository->index->cache_tree = NULL;
19 if (write_locked_index(the_repository->index, &index_lock, COMMIT_LOCK))
1aed2fe3
TR
20 die("unable to write index file");
21 return 0;
22}