MCPcopy Index your code
hub / github.com/git/git / cmd__read_cache

Function cmd__read_cache

t/helper/test-read-cache.c:10–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8#include "setup.h"
9
10int 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}

Callers

nothing calls this directly

Calls 8

setup_git_directoryFunction · 0.85
repo_read_indexFunction · 0.85
refresh_indexFunction · 0.85
index_name_posFunction · 0.85
write_fileFunction · 0.85
discard_indexFunction · 0.85
repo_configFunction · 0.50
dieFunction · 0.50

Tested by

no test coverage detected