diff options
author | Christian Couder <christian.couder@gmail.com> | 2017-02-27 19:00:13 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-01 13:34:54 -0800 |
commit | 77d67977cac46aa6c07c66ce9e2470f00feb9d20 (patch) | |
tree | 580440bf17327f2d08c337d6f05cbb0836895c26 /config.c | |
parent | read-cache: touch shared index files when used (diff) | |
download | tgif-77d67977cac46aa6c07c66ce9e2470f00feb9d20.tar.xz |
config: add git_config_get_expiry() from gc.c
This function will be used in a following commit to get the expiration
time of the shared index files from the config, and it is generic
enough to be put in "config.c".
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1685,6 +1685,19 @@ int git_config_get_pathname(const char *key, const char **dest) return ret; } +int git_config_get_expiry(const char *key, const char **output) +{ + int ret = git_config_get_string_const(key, output); + if (ret) + return ret; + if (strcmp(*output, "now")) { + unsigned long now = approxidate("now"); + if (approxidate(*output) >= now) + git_die_config(key, _("Invalid %s: '%s'"), key, *output); + } + return ret; +} + int git_config_get_untracked_cache(void) { int val = -1; |