refs: convert resolve_ref_unsafe to struct object_id
[git/debian.git] / t / helper / test-write-cache.c
blobb7ee0396692b6143e852af16695dd5800c0044be
1 #include "cache.h"
2 #include "lockfile.h"
4 static struct lock_file index_lock;
6 int cmd_main(int argc, const char **argv)
8 int i, cnt = 1, lockfd;
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++) {
14 lockfd = hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR);
15 if (0 <= lockfd) {
16 write_locked_index(&the_index, &index_lock, COMMIT_LOCK);
17 } else {
18 rollback_lock_file(&index_lock);
22 return 0;