Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/helper/test-write-cache.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / helper / test-write-cache.c` 25 lines ยท 630 bytes Raw Blame History 1 #define USE_THE_REPOSITORY_VARIABLE 2 3 #include "test-tool.h" 4 #include "lockfile.h" 5 #include "read-cache-ll.h" 6 #include "repository.h" 7 #include "setup.h" 8 9 int cmd__write_cache(int argc, const char **argv) 10 { 11 struct lock_file index_lock = LOCK_INIT; 12 int i, cnt = 1; 13 if (argc == 2) 14 cnt = strtol(argv[1], NULL, 0); 15 setup_git_directory(the_repository); 16 repo_read_index(the_repository); 17 for (i = 0; i < cnt; i++) { 18 repo_hold_locked_index(the_repository, &index_lock, 19 LOCK_DIE_ON_ERROR); 20 if (write_locked_index(the_repository->index, &index_lock, COMMIT_LOCK)) 21 die("unable to write index file"); 22 } 23 24 return 0; 25 }