refspec-api: avoid uninitialized field in refspec item
[git/git-svn.git] / t / helper / test-write-cache.c
blob017dc303800d9ba385a9836d85f81445c6b7e8b7
1 #include "test-tool.h"
2 #include "cache.h"
3 #include "lockfile.h"
5 static struct lock_file index_lock;
7 int cmd__write_cache(int argc, const char **argv)
9 int i, cnt = 1, lockfd;
10 if (argc == 2)
11 cnt = strtol(argv[1], NULL, 0);
12 setup_git_directory();
13 read_cache();
14 for (i = 0; i < cnt; i++) {
15 lockfd = hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
16 if (0 <= lockfd) {
17 write_locked_index(&the_index, &index_lock, COMMIT_LOCK);
18 } else {
19 rollback_lock_file(&index_lock);
23 return 0;