diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-08-26 22:55:08 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-26 22:55:08 -0700 |
commit | 96352ef9b4dfeb38ec796e7eab010edfe8f978ba (patch) | |
tree | 23ef65fd24b4fcfff8610be002f566ded95d9eee /config.c | |
parent | Merge branch 'kw/write-index-reduce-alloc' (diff) | |
parent | rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved (diff) | |
download | tgif-96352ef9b4dfeb38ec796e7eab010edfe8f978ba.tar.xz |
Merge branch 'jc/cutoff-config'
"[gc] rerereResolved = 5.days" used to be invalid, as the variable
is defined to take an integer counting the number of days. It now
is allowed.
* jc/cutoff-config:
rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved
rerere: represent time duration in timestamp_t internally
t4200: parameterize "rerere gc" custom expiry test
t4200: gather "rerere gc" together
t4200: make "rerere gc" test more robust
t4200: give us a clean slate after "rerere gc" tests
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -2094,6 +2094,28 @@ int git_config_get_expiry(const char *key, const char **output) return ret; } +int git_config_get_expiry_in_days(const char *key, timestamp_t *expiry, timestamp_t now) +{ + char *expiry_string; + intmax_t days; + timestamp_t when; + + if (git_config_get_string(key, &expiry_string)) + return 1; /* no such thing */ + + if (git_parse_signed(expiry_string, &days, maximum_signed_value_of_type(int))) { + const int scale = 86400; + *expiry = now - days * scale; + return 0; + } + + if (!parse_expiry_date(expiry_string, &when)) { + *expiry = when; + return 0; + } + return -1; /* thing exists but cannot be parsed */ +} + int git_config_get_untracked_cache(void) { int val = -1; |