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