]> git.ipfire.org Git - thirdparty/git.git/blame - t/helper/test-write-cache.c
Merge branch 'js/mingw-needs-hiding-fix'
[thirdparty/git.git] / t / helper / test-write-cache.c
CommitLineData
c81f843d 1#include "test-tool.h"
3921a0b3
KW
2#include "cache.h"
3#include "lockfile.h"
4
c81f843d 5int cmd__write_cache(int argc, const char **argv)
3921a0b3 6{
75d9a25e
7 struct lock_file index_lock = LOCK_INIT;
8 int i, cnt = 1;
3921a0b3
KW
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++) {
75d9a25e
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");
3921a0b3
KW
17 }
18
19 return 0;
20}