diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-12-06 09:23:37 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-12-06 09:23:37 -0800 |
commit | 6cddb7362ca3c7312b57a4f172bca5c953a45b6c (patch) | |
tree | 62b363b31ccae02533ee81eea365cb975ab39cce /builtin/reflog.c | |
parent | 0186e9ebedfb18ad02fe20af18cc35526760fbad (diff) | |
parent | 5f9674243d0341519e5031681c941b0e1ad7a9e3 (diff) | |
download | git-6cddb7362ca3c7312b57a4f172bca5c953a45b6c.tar.gz git-6cddb7362ca3c7312b57a4f172bca5c953a45b6c.tar.xz |
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 'builtin/reflog.c')
-rw-r--r-- | builtin/reflog.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c index ab31a3b6a..223372531 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -416,16 +416,6 @@ static struct reflog_expire_cfg *find_cfg_ent(const char *pattern, size_t len) return ent; } -static int parse_expire_cfg_value(const char *var, const char *value, timestamp_t *expire) -{ - if (!value) - return config_error_nonbool(var); - if (parse_expiry_date(value, expire)) - return error(_("'%s' for '%s' is not a valid timestamp"), - value, var); - return 0; -} - /* expiry timer slot */ #define EXPIRE_TOTAL 01 #define EXPIRE_UNREACH 02 @@ -443,11 +433,11 @@ static int reflog_expire_config(const char *var, const char *value, void *cb) if (!strcmp(key, "reflogexpire")) { slot = EXPIRE_TOTAL; - if (parse_expire_cfg_value(var, value, &expire)) + if (git_config_expiry_date(&expire, var, value)) return -1; } else if (!strcmp(key, "reflogexpireunreachable")) { slot = EXPIRE_UNREACH; - if (parse_expire_cfg_value(var, value, &expire)) + if (git_config_expiry_date(&expire, var, value)) return -1; } else return git_default_config(var, value, cb); |