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

Re: [PATCH v2 5/6] date: document and test "raw-local" mode

From
Jeff King <peff@peff.net>
Date
Jul 26, 2016, 18:47 UTC
Message-ID
<20160726184746.GA678@sigill.intra.peff.net>
In-Reply-To
<579343C9.1040902@gmail.com>
On Sat, Jul 23, 2016 at 12:15:37PM +0200, Jakub Narębski wrote:
Show 21 quoted lines
> > diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
> > index 5d1de06..3ec75d4 100644
> > --- a/Documentation/rev-list-options.txt
> > +++ b/Documentation/rev-list-options.txt
> > @@ -725,8 +725,8 @@ include::pretty-options.txt[]
> >  	`iso-local`), the user's local time zone is used instead.
> >  +
> >  `--date=relative` shows dates relative to the current time,
> > -e.g. ``2 hours ago''. The `-local` option cannot be used with
> > -`--raw` or `--relative`.
> > +e.g. ``2 hours ago''. The `-local` option has no effect for
> > +`--relative`.
> 
> Do I understand it correctly: --relative is a short form for more
> generic --date=relative (which probably should be spelled 
> --date-format=relative), and that --date=relative-local is the
> same as --date=relative, that is *-local suffix does not change
> how date is formatted?
> 
> Because I don't think you can say --relative-local ("The `-local`
> option has no effect on `--relative`"), can you?

All correct. There is no --relative-local because "--relative" is a historical artifact. We could support --foo for every --date=foo, but I don't think there is a reason to do so (and reasons not to, like avoiding cluttering the option space).

Show 7 quoted lines
> > -`--date=raw` shows the date in the internal raw Git format `%s %z` format.
> > +`--date=raw` shows the date in the internal raw Git format `%s %z`
> > +format. Note that the `-local` option does not affect the
> > +seconds-since-epoch value (which is always measured in UTC), but does
> > +switch the accompanying timezone value.
> 
> Which is correct, logical, and next to useless, I think.

This was discussed in the earlier review. It's basically only useful if you are feeding the output to another script which will format the date and want to change what that script shows.

Show 10 quoted lines
> BTW. one kind of format that Git does not support (I think) is the
> varying kind, where the precision changes with the distance from now,
> so that we can get most precision in limited width.  That's what
> `ls --long` does:
> 
>  * 'Jun 29 16:47' for dates falling in current year (more precision)
>  * 'Nov 23  2015' for dates outside (less precision, same width)
> 
> Many other programs switch from relative to absolute time when date
> in question is far in the past that relative is not very good.

Yes, this was discussed on the list not too long ago. I think it would be useful, but is obviously orthogonal to this series.

-Peff
Previous: Jakub NarębskiNext: Jakub Narębski
Message 8 of 16 in “reflog docs and date-formatting”
  1. 0/6 reflog docs and date-formattingJeff King, Jul 22, 2016
  2. 1/6 doc/rev-list-options: clarify "commit@{Nth}" for "-g" optionJeff King, Jul 22, 2016
  3. 2/6 doc/rev-list-options: explain "-g" output formatsJeff King, Jul 22, 2016
  4. 3/6 doc/pretty-formats: describe index/time formats for %gdJeff King, Jul 22, 2016
  5. 4/6 doc/pretty-formats: explain shortening of %gdJeff King, Jul 22, 2016
  6. 5/6 date: document and test "raw-local" modeJeff King, Jul 22, 2016
  7. Jakub NarębskiJul 23, 2016
  8. Jeff KingJul 26, 2016
  9. Jakub NarębskiJul 27, 2016
  10. 5/6 date: document and test "raw-local" modeJeff King, Jul 27, 2016
  11. Junio C HamanoJul 27, 2016
  12. Jeff KingJul 27, 2016
  13. Junio C HamanoJul 27, 2016
  14. Jeff KingJul 27, 2016
  15. Junio C HamanoJul 27, 2016
  16. 6/6 date: add "unix" formatJeff King, Jul 22, 2016

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.