From: Junio C Hamano <gitster@pobox.com>
To: Simon Ruderich <simon@ruderich.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Silly "git gc" UI issue.
Date: Fri, 20 Apr 2018 09:14:18 +0900 [thread overview]
Message-ID: <xmqqlgdid99h.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180419103447.GA19591@ruderich.org> (Simon Ruderich's message of "Thu, 19 Apr 2018 12:34:47 +0200")
Simon Ruderich <simon@ruderich.org> writes:
> 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?
I do not have a strong opinion on this, because I would expect that
"git log --since=nyah" to do whatever random things it may want to
do.
But I suspect I am a minority, and if we were to change the
established behaviour, I agree that erroring out using
approxidate_careful() is the right direction to go in.
Thanks.
> 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
prev parent reply other threads:[~2018-04-20 0:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 1:45 Silly "git gc" UI issue Linus Torvalds
2018-04-19 1:52 ` Junio C Hamano
2018-04-19 1:55 ` Junio C Hamano
2018-04-19 2:16 ` Junio C Hamano
2018-04-19 2:29 ` Linus Torvalds
2018-04-19 3:22 ` Junio C Hamano
2018-04-19 5:10 ` Junio C Hamano
2018-04-20 7:27 ` Simon Ruderich
2018-04-21 3:13 ` Junio C Hamano
2018-04-21 6:07 ` Christian Couder
2018-04-23 13:38 ` Junio C Hamano
2018-04-19 2:19 ` Linus Torvalds
2018-04-19 10:34 ` Simon Ruderich
2018-04-20 0:14 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqlgdid99h.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=simon@ruderich.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).