debian: new upstream release
[git/debian.git] / t / helper / test-write-cache.c
blob8837717d36a77c04346279b570e1a0a4506fe838
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "lockfile.h"
5 int cmd__write_cache(int argc, const char **argv)
7 struct lock_file index_lock = LOCK_INIT;
8 int i, cnt = 1;
9 if (argc == 2)
10 cnt = strtol(argv[1], NULL, 0);
11 setup_git_directory();
12 read_cache();
13 for (i = 0; i < cnt; i++) {
14 hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
15 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
16 die("unable to write index file");
19 return 0;