On Thu, Apr 19, 2018 at 10:52:47AM +0900, Junio C Hamano wrote:
> It turns out that prune silently goes away given a bad expiry
>
> $ git prune --expire=nyah ; echo $?
> 129
I noticed that git log --since/--after/--before/--until have a
similar behavior and ignore date parsing errors in those options
completely. Is this expected or should we warn the user with
something like the following?
diff --git a/revision.c b/revision.c
index 4e0e193e57..e5ba6c7dfc 100644
--- a/revision.c
+++ b/revision.c
@@ -1794,19 +1794,31 @@ static int handle_revision_opt(struct rev_info *revs,
int argc, const char **arg
revs->max_age = atoi(optarg);
return argcount;
} else if ((argcount = parse_long_opt("since", argv, &optarg))) {
- revs->max_age = approxidate(optarg);
+ int err = 0;
+ revs->max_age = approxidate_careful(optarg, &err);
+ if (err)
+ return error("--since: invalid time '%s'", optarg);
return argcount;
} else if ((argcount = parse_long_opt("after", argv, &optarg))) {
- revs->max_age = approxidate(optarg);
+ int err = 0;
+ revs->max_age = approxidate_careful(optarg, &err);
+ if (err)
+ return error("--after: invalid time '%s'", optarg);
return argcount;
} else if ((argcount = parse_long_opt("min-age", argv, &optarg))) {
revs->min_age = atoi(optarg);
return argcount;
} else if ((argcount = parse_long_opt("before", argv, &optarg))) {
- revs->min_age = approxidate(optarg);
+ int err = 0;
+ revs->min_age = approxidate_careful(optarg, &err);
+ if (err)
+ return error("--before: invalid time '%s'", optarg);
return argcount;
} else if ((argcount = parse_long_opt("until", argv, &optarg))) {
- revs->min_age = approxidate(optarg);
+ int err = 0;
+ revs->min_age = approxidate_careful(optarg, &err);
+ if (err)
+ return error("--until: invalid time '%s'");
return argcount;
} else if (!strcmp(arg, "--first-parent")) {
revs->first_parent_only = 1;
Regards
Simon
--
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9