]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-write-cache.c
Merge branch 'fc/remove-header-workarounds-for-asciidoc'
[thirdparty/git.git] / t / helper / test-write-cache.c
1 #define USE_THE_INDEX_VARIABLE
2 #include "test-tool.h"
3 #include "cache.h"
4 #include "lockfile.h"
5 #include "setup.h"
6
7 int cmd__write_cache(int argc, const char **argv)
8 {
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");
20 }
21
22 return 0;
23 }