From: Junio C Hamano Date: Thu, 19 Apr 2018 05:10:40 GMT Subject: Re: Silly "git gc" UI issue. Message-ID: In-Reply-To: Linus Torvalds writes: > Maybe something like the attached patch? Then I get: > ... > [torvalds@i7 linux]$ time git gc --prune=npw > fatal: Failed to parse prune expiry value npw > > real 0m0.004s > user 0m0.002s > sys 0m0.002s > > and you could smush it into your commit (if you want my sign-off, take it) > > Linus > > builtin/gc.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/builtin/gc.c b/builtin/gc.c > index 3e67124ea..a4b20aaaf 100644 > --- a/builtin/gc.c > +++ b/builtin/gc.c > @@ -354,6 +354,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) > const char *name; > pid_t pid; > int daemonized = 0; > + timestamp_t dummy; > > struct option builtin_gc_options[] = { > OPT__QUIET(&quiet, N_("suppress progress reporting")), > @@ -392,6 +393,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix) > if (argc > 0) > usage_with_options(builtin_gc_usage, builtin_gc_options); > > + if (parse_expiry_date(prune_expire, &dummy)) > + die(_("Failed to parse prune expiry value %s"), prune_expire); > + At this point prune_expire could be NULL, so the if() needs a bit tightening, but otherwise it looks good. Here is the final one (at least for today). -- >8 -- Subject: [PATCH] parseopt: handle malformed --expire arguments nicer A few commands that parse --expire=