]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-write-cache.c
Merge branch 'es/add-doc-list-short-form-of-all-in-synopsis'
[thirdparty/git.git] / t / helper / test-write-cache.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
8 int cmd__write_cache(int argc, const char **argv)
9 {
10 struct lock_file index_lock = LOCK_INIT;
11 int i, cnt = 1;
12 if (argc == 2)
13 cnt = strtol(argv[1], NULL, 0);
14 setup_git_directory();
15 repo_read_index(the_repository);
16 for (i = 0; i < cnt; i++) {
17 repo_hold_locked_index(the_repository, &index_lock,
18 LOCK_DIE_ON_ERROR);
19 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
20 die("unable to write index file");
21 }
22
23 return 0;
24 }