summaryrefslogtreecommitdiff
path: root/builtin/reflog.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-05-29 21:23:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-05-29 21:23:04 (GMT)
commit3e1e7624aa2aa39890ca49d0f7bd3af397c22b03 (patch)
tree013e8e03f854c3458c0c90f7298244ef7efb6e56 /builtin/reflog.c
parent305e19bdc315f302b935d50abff4a1a405e14b71 (diff)
parent27ec394a9701675762f02e9af464be2c297c6cf1 (diff)
downloadgit-3e1e7624aa2aa39890ca49d0f7bd3af397c22b03.zip
git-3e1e7624aa2aa39890ca49d0f7bd3af397c22b03.tar.gz
git-3e1e7624aa2aa39890ca49d0f7bd3af397c22b03.tar.bz2
Merge branch 'jc/prune-all'
We used the approxidate() parser for "--expire=<timestamp>" options of various commands, but it is better to treat --expire=all and --expire=now a bit more specially than using the current timestamp. Update "git gc" and "git reflog" with a new parsing function for expiry dates. * jc/prune-all: prune: introduce OPT_EXPIRY_DATE() and use it api-parse-options.txt: document "no-" for non-boolean options git-gc.txt, git-reflog.txt: document new expiry options date.c: add parse_expiry_date()
Diffstat (limited to 'builtin/reflog.c')
-rw-r--r--builtin/reflog.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c
index 72a0af7..54184b3 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -496,11 +496,9 @@ static int parse_expire_cfg_value(const char *var, const char *value, unsigned l
{
if (!value)
return config_error_nonbool(var);
- if (!strcmp(value, "never") || !strcmp(value, "false")) {
- *expire = 0;
- return 0;
- }
- *expire = approxidate(value);
+ if (parse_expiry_date(value, expire))
+ return error(_("%s' for '%s' is not a valid timestamp"),
+ value, var);
return 0;
}
@@ -614,11 +612,13 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
if (!strcmp(arg, "--dry-run") || !strcmp(arg, "-n"))
cb.dry_run = 1;
else if (!prefixcmp(arg, "--expire=")) {
- cb.expire_total = approxidate(arg + 9);
+ if (parse_expiry_date(arg + 9, &cb.expire_total))
+ die(_("'%s' is not a valid timestamp"), arg);
explicit_expiry |= EXPIRE_TOTAL;
}
else if (!prefixcmp(arg, "--expire-unreachable=")) {
- cb.expire_unreachable = approxidate(arg + 21);
+ if (parse_expiry_date(arg + 21, &cb.expire_unreachable))
+ die(_("'%s' is not a valid timestamp"), arg);
explicit_expiry |= EXPIRE_UNREACH;
}
else if (!strcmp(arg, "--stale-fix"))