summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-12-06 09:23:37 -0800
committerJunio C Hamano <gitster@pobox.com>2017-12-06 09:23:37 -0800
commit6cddb7362ca3c7312b57a4f172bca5c953a45b6c (patch)
tree62b363b31ccae02533ee81eea365cb975ab39cce /config.c
parent0186e9ebedfb18ad02fe20af18cc35526760fbad (diff)
parent5f9674243d0341519e5031681c941b0e1ad7a9e3 (diff)
downloadgit-6cddb7362ca3c7312b57a4f172bca5c953a45b6c.tar.gz
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
Diffstat (limited to 'config.c')
-rw-r--r--config.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/config.c b/config.c
index 676786a028..e617c2018d 100644
--- a/config.c
+++ b/config.c
@@ -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 */