diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-05-19 07:45:33 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-19 07:45:33 (GMT) |
commit | cfd635c7428dfca5b45d8d45fdc1311e751d4fe2 (patch) | |
tree | 3bd1754e72887659e52ee03342a4a9098fe9c247 /t/helper | |
parent | 521d3ef38a17917ad10e71a398e82a13fa1178b5 (diff) | |
parent | 398a3b0899dd8a440d4adbcbda38362e3f8359b1 (diff) | |
download | git-cfd635c7428dfca5b45d8d45fdc1311e751d4fe2.zip git-cfd635c7428dfca5b45d8d45fdc1311e751d4fe2.tar.gz git-cfd635c7428dfca5b45d8d45fdc1311e751d4fe2.tar.bz2 |
Merge branch 'js/fsmonitor-refresh-after-discarding-index'
The fsmonitor interface got out of sync after the in-core index
file gets discarded, which has been corrected.
* js/fsmonitor-refresh-after-discarding-index:
fsmonitor: force a refresh after the index was discarded
fsmonitor: demonstrate that it is not refreshed after discard_index()
Diffstat (limited to 't/helper')
-rw-r--r-- | t/helper/test-read-cache.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c index d674c88..7e79b55 100644 --- a/t/helper/test-read-cache.c +++ b/t/helper/test-read-cache.c @@ -1,14 +1,36 @@ #include "test-tool.h" #include "cache.h" +#include "config.h" int cmd__read_cache(int argc, const char **argv) { - int i, cnt = 1; + int i, cnt = 1, namelen; + const char *name = NULL; + + if (argc > 1 && skip_prefix(argv[1], "--print-and-refresh=", &name)) { + namelen = strlen(name); + argc--; + argv++; + } + if (argc == 2) cnt = strtol(argv[1], NULL, 0); setup_git_directory(); + git_config(git_default_config, NULL); for (i = 0; i < cnt; i++) { read_cache(); + if (name) { + int pos; + + refresh_index(&the_index, REFRESH_QUIET, + NULL, NULL, NULL); + pos = index_name_pos(&the_index, name, namelen); + if (pos < 0) + die("%s not in index", name); + printf("%s is%s up to date\n", name, + ce_uptodate(the_index.cache[pos]) ? "" : " not"); + write_file(name, "%d\n", i); + } discard_cache(); } return 0; |