1 #define USE_THE_INDEX_VARIABLE
5 #include "read-cache-ll.h"
6 #include "repository.h"
10 int cmd__read_cache(int argc
, const char **argv
)
13 const char *name
= NULL
;
15 initialize_the_repository();
17 if (argc
> 1 && skip_prefix(argv
[1], "--print-and-refresh=", &name
)) {
23 cnt
= strtol(argv
[1], NULL
, 0);
24 setup_git_directory();
25 git_config(git_default_config
, NULL
);
27 for (i
= 0; i
< cnt
; i
++) {
28 repo_read_index(the_repository
);
32 refresh_index(&the_index
, REFRESH_QUIET
,
34 pos
= index_name_pos(&the_index
, name
, strlen(name
));
36 die("%s not in index", name
);
37 printf("%s is%s up to date\n", name
,
38 ce_uptodate(the_index
.cache
[pos
]) ? "" : " not");
39 write_file(name
, "%d\n", i
);
41 discard_index(&the_index
);