1 #define USE_THE_REPOSITORY_VARIABLE
5 #include "read-cache-ll.h"
6 #include "repository.h"
9 int cmd__read_cache(int argc
, const char **argv
)
12 const char *name
= NULL
;
14 initialize_repository(the_repository
);
16 if (argc
> 1 && skip_prefix(argv
[1], "--print-and-refresh=", &name
)) {
22 cnt
= strtol(argv
[1], NULL
, 0);
23 setup_git_directory();
24 git_config(git_default_config
, NULL
);
26 for (i
= 0; i
< cnt
; i
++) {
27 repo_read_index(the_repository
);
31 refresh_index(the_repository
->index
, REFRESH_QUIET
,
33 pos
= index_name_pos(the_repository
->index
, name
, strlen(name
));
35 die("%s not in index", name
);
36 printf("%s is%s up to date\n", name
,
37 ce_uptodate(the_repository
->index
->cache
[pos
]) ? "" : " not");
38 write_file(name
, "%d\n", i
);
40 discard_index(the_repository
->index
);