setup.h: move declarations for setup.c functions from cache.h
[git.git] / t / helper / test-write-cache.c
bloba93417ed3a97c8a027e49dd6e2b6851295227dd0
1 #define USE_THE_INDEX_VARIABLE
2 #include "test-tool.h"
3 #include "cache.h"
4 #include "lockfile.h"
5 #include "setup.h"
7 int cmd__write_cache(int argc, const char **argv)
9 struct lock_file index_lock = LOCK_INIT;
10 int i, cnt = 1;
11 if (argc == 2)
12 cnt = strtol(argv[1], NULL, 0);
13 setup_git_directory();
14 repo_read_index(the_repository);
15 for (i = 0; i < cnt; i++) {
16 repo_hold_locked_index(the_repository, &index_lock,
17 LOCK_DIE_ON_ERROR);
18 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
19 die("unable to write index file");
22 return 0;