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>
This commit is contained in:

committed by
Junio C Hamano

parent
0d59ffb47e
commit
77d67977ca
13
config.c
13
config.c
@ -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;
|
||||
|
Reference in New Issue
Block a user