git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
John Keeping <john@keeping.me.uk>
Date
Sep 2, 2015, 22:07 UTC
Message-ID
<20150902220740.GN30659@serenity.lan>
In-Reply-To
<20150902213013.GB21612@sigill.intra.peff.net>
On Wed, Sep 02, 2015 at 05:30:14PM -0400, Jeff King wrote:
Show 36 quoted lines
> On Wed, Sep 02, 2015 at 10:41:34AM -0700, Junio C Hamano wrote:
> 
> > Jeff King <peff@peff.net> 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").

Previous: Jeff KingNext: Junio C Hamano
Message 58 of 59 in “date: allow any format to display local time”
  1. date: allow any format to display local timeJohn Keeping, Aug 30, 2015
  2. Junio C HamanoAug 31, 2015
  3. Jeff KingAug 31, 2015
  4. Jeff KingAug 31, 2015
  5. Junio C HamanoAug 31, 2015
  6. John KeepingAug 31, 2015
  7. Jeff KingAug 31, 2015
  8. 1/2 fast-import: switch crash-report date to iso8601Jeff King, Aug 31, 2015
  9. 2/2 date: make "local" orthogonal to date formatJeff King, Aug 31, 2015
  10. John KeepingAug 31, 2015
  11. Jeff KingAug 31, 2015
  12. Jeff KingAug 31, 2015
  13. John KeepingSep 1, 2015
  14. 0/6 Make "local" orthogonal to date formatJohn Keeping, Sep 1, 2015
  15. 1/6 fast-import: switch crash-report date to iso8601John Keeping, Sep 1, 2015
  16. 2/6 date: make "local" orthogonal to date formatJohn Keeping, Sep 1, 2015
  17. Junio C HamanoSep 1, 2015
  18. Jeff KingSep 1, 2015
  19. John KeepingSep 1, 2015
  20. Jeff KingSep 1, 2015
  21. Junio C HamanoSep 1, 2015
  22. Junio C HamanoSep 2, 2015
  23. 3/6 t6300: introduce test_date() helperJohn Keeping, Sep 1, 2015
  24. Junio C HamanoSep 1, 2015
  25. Eric SunshineSep 1, 2015
  26. Jeff KingSep 1, 2015
  27. John KeepingSep 1, 2015
  28. Jeff KingSep 1, 2015
  29. 4/6 t6300: make UTC and local dates differentJohn Keeping, Sep 1, 2015
  30. 5/6 t6300: add test for "raw" date formatJohn Keeping, Sep 1, 2015
  31. 6/6 t6300: add tests for "-local" date formatsJohn Keeping, Sep 1, 2015
  32. Jeff KingSep 1, 2015
  33. John KeepingSep 2, 2015
  34. Jeff KingSep 2, 2015
  35. Junio C HamanoSep 2, 2015
  36. John KeepingSep 2, 2015
  37. Junio C HamanoSep 2, 2015
  38. John KeepingSep 2, 2015
  39. Junio C HamanoSep 2, 2015
  40. Jeff KingSep 2, 2015
  41. 00/11 Make "local" orthogonal to date formatJohn Keeping, Sep 3, 2015
  42. 01/11 Documentation/blame-options: don't list date formatsJohn Keeping, Sep 3, 2015
  43. 02/11 Documentation/config: don't list date formatsJohn Keeping, Sep 3, 2015
  44. 03/11 Documentation/git-for-each-ref: don't list date formatsJohn Keeping, Sep 3, 2015
  45. 04/11 Documentation/rev-list: don't list date formatsJohn Keeping, Sep 3, 2015
  46. Junio C HamanoSep 3, 2015
  47. 05/11 fast-import: switch crash-report date to iso8601John Keeping, Sep 3, 2015
  48. 06/11 t6300: introduce test_date() helperJohn Keeping, Sep 3, 2015
  49. 07/11 t6300: add test for "raw" date formatJohn Keeping, Sep 3, 2015
  50. 08/11 date: check for "local" before anything elseJohn Keeping, Sep 3, 2015
  51. Junio C HamanoSep 3, 2015
  52. 09/11 date: make "local" orthogonal to date formatJohn Keeping, Sep 3, 2015
  53. 10/11 t6300: make UTC and local dates differentJohn Keeping, Sep 3, 2015
  54. 11/11 t6300: add tests for "-local" date formatsJohn Keeping, Sep 3, 2015
  55. Jeff KingSep 8, 2015
  56. Junio C HamanoSep 2, 2015
  57. Jeff KingSep 2, 2015
  58. John KeepingSep 2, 2015
  59. Junio C HamanoSep 3, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.