]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-scrap-cache-tree.c
Merge branch 'bb/unicode-width-table-15'
[thirdparty/git.git] / t / helper / test-scrap-cache-tree.c
1 #define USE_THE_INDEX_VARIABLE
2 #include "test-tool.h"
3 #include "lockfile.h"
4 #include "read-cache-ll.h"
5 #include "repository.h"
6 #include "setup.h"
7 #include "tree.h"
8 #include "cache-tree.h"
9
10 int cmd__scrap_cache_tree(int ac UNUSED, const char **av UNUSED)
11 {
12 struct lock_file index_lock = LOCK_INIT;
13
14 setup_git_directory();
15 repo_hold_locked_index(the_repository, &index_lock, LOCK_DIE_ON_ERROR);
16 if (repo_read_index(the_repository) < 0)
17 die("unable to read index file");
18 cache_tree_free(&the_index.cache_tree);
19 the_index.cache_tree = NULL;
20 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
21 die("unable to write index file");
22 return 0;
23 }