]> git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-write-cache.c
t/lib-gpg: require GPGSSH for GPGSSH_VERIFYTIME prereq
[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
6 int cmd__write_cache(int argc, const char **argv)
7 {
8 struct lock_file index_lock = LOCK_INIT;
9 int i, cnt = 1;
10 if (argc == 2)
11 cnt = strtol(argv[1], NULL, 0);
12 setup_git_directory();
13 repo_read_index(the_repository);
14 for (i = 0; i < cnt; i++) {
15 repo_hold_locked_index(the_repository, &index_lock,
16 LOCK_DIE_ON_ERROR);
17 if (write_locked_index(&the_index, &index_lock, COMMIT_LOCK))
18 die("unable to write index file");
19 }
20
21 return 0;
22 }