Merge branch 'hm/config-parse-expiry-date'

"git config --expiry-date gc.reflogexpire" can read "2.weeks" from
the configuration and report it as a timestamp, just like "--int"
would read "1k" and report 1024, to help consumption by scripts.

* hm/config-parse-expiry-date:
  config: add --expiry-date
This commit is contained in:
Junio C Hamano
2017-12-06 09:23:37 -08:00
7 changed files with 69 additions and 13 deletions

View File

@ -990,6 +990,16 @@ int git_config_pathname(const char **dest, const char *var, const char *value)
return 0;
}
int git_config_expiry_date(timestamp_t *timestamp, const char *var, const char *value)
{
if (!value)
return config_error_nonbool(var);
if (parse_expiry_date(value, timestamp))
return error(_("'%s' for '%s' is not a valid timestamp"),
value, var);
return 0;
}
static int git_default_core_config(const char *var, const char *value)
{
/* This needs a better name */