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-read-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-read-cache.c` 42 lines ยท 1010 bytes Raw Blame History 1 #define USE_THE_REPOSITORY_VARIABLE 2 3 #include "test-tool.h" 4 #include "config.h" 5 #include "environment.h" 6 #include "read-cache-ll.h" 7 #include "repository.h" 8 #include "setup.h" 9 10 int cmd__read_cache(int argc, const char **argv) 11 { 12 int i, cnt = 1; 13 const char *name = NULL; 14 15 if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) { 16 argc--; 17 argv++; 18 } 19 20 if (argc == 2) 21 cnt = strtol(argv[1], NULL, 0); 22 setup_git_directory(the_repository); 23 repo_config(the_repository, git_default_config, NULL); 24 25 for (i = 0; i < cnt; i++) { 26 repo_read_index(the_repository); 27 if (name) { 28 int pos; 29 30 refresh_index(the_repository->index, REFRESH_QUIET, 31 NULL, NULL, NULL); 32 pos = index_name_pos(the_repository->index, name, strlen(name)); 33 if (pos < 0) 34 die("%s not in index", name); 35 printf("%s is%s up to date\n", name, 36 ce_uptodate(the_repository->index->cache[pos]) ? "" : " not"); 37 write_file(name, "%d\n", i); 38 } 39 discard_index(the_repository->index); 40 } 41 return 0; 42 }