Subject: Re: [PATCH 2/2] date: make "local" orthogonal to date format

From: John Keeping <[email-masked]>
Date: Wed, 2 Sep 2015 23:07:40 +0100

On Wed, Sep 02, 2015 at 05:30:14PM -0400, Jeff King wrote:
> On Wed, Sep 02, 2015 at 10:41:34AM -0700, Junio C Hamano wrote:
> 
> > Jeff King <[email-masked]> writes:
> > 
> > > +	/* historical alias */
> > > +	if (!strcmp(format, "local"))
> > > +		format = "default-local";
> > > +
> > > +	mode->type = parse_date_type(format, &p);
> > > +	mode->local = 0;
> > > +
> > > +	if (skip_prefix(p, "-local", &p)) {
> > > +		if (mode->type == DATE_RELATIVE)
> > > +			die("relative-local date format is nonsensical");
> > > +		mode->local = 1;
> > > +	}
> > 
> > I notice that we give something funny like this:
> > 
> >     $ git show --date=short-locale
> >     fatal: unknown date-mode modifier: e
> 
> Yeah, that's not ideal.
> 
> > What is the intention here?  In other words, what kind of things can
> > plausibly follow "--date=short-local" in enhanced versions of Git in
> > the future?  "--date=short-local:some other magic"?
> 
> I had assumed it would be "short-local-othermagic", since ":" is already
> the separator for "format:". But I admit I have no idea what other
> modifiers would be interesting.
> 
> I think the error message would be a lot nicer if we indicate that "-"
> is syntactically interesting, and say:
> 
>   fatal: unknown date-mode modifier: locale

I wonder if we'd be better just saying:

	fatal: unknown date format: short-locale

I'm not sure users will consider "local" to be a modifier, there is
simply a list of formats that happens to include pairs of matching
"-local" and "not -local" variants.

That has the benefit of keeping the code simple, otherwise we have to
worry about "shorter" as well (in the patch as it stands that gives
"unknown date-mode modifier: er").