]>
git.ipfire.org Git - thirdparty/git.git/blob - t/helper/test-read-cache.c
1 #define USE_THE_INDEX_VARIABLE
4 #include "read-cache-ll.h"
5 #include "repository.h"
9 int cmd__read_cache(int argc
, const char **argv
)
12 const char *name
= NULL
;
14 initialize_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_index
, REFRESH_QUIET
,
33 pos
= index_name_pos(&the_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_index
.cache
[pos
]) ? "" : " not");
38 write_file(name
, "%d\n", i
);
40 discard_index(&the_index
);