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

Re: [PATCH] pretty format string support for reflog times

From
Jeff King <peff@peff.net>
Date
Jul 27, 2016, 18:17 UTC
Message-ID
<20160727181725.GD32219@sigill.intra.peff.net>
In-Reply-To
<xmqqfuqvvtph.fsf@gitster.mtv.corp.google.com>
On Wed, Jul 27, 2016 at 11:09:30AM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> I am still in favor of this suggestion you earlier made:
> 
> > So the final solution is more like:
> > 
> >   - a formatter for just the reflog time, respecting date
> > 
> >   - a formatter for just the reflog index (the "0" in HEAD@{0})
> > 
> >   - a formatter for the ref name (just the "HEAD" in HEAD@{0})
> 
> though.  After all we only need three short ones while we migrate
> away to a longer %(reflog:<what>) format, right?
Yes, I think those three would be sufficient to allow something like:
  HEAD@{0} (1 month ago) ...

where the relative time would come from "%gT" mixed with "--date=relative". What that doesn't allow is showing the time in multiple formats with different placeholders, like:

  HEAD@{0} (2016-06-25T01:23:45 -- 1 month ago) ...

For that you need either format-specific placeholders, or a generic date placeholder which can specify the format, like:

  %(reflog-date:relative)

So if you mean doing those on _top_ of what Phil and Ted are proposing, I think it is pretty flexible, but just a bit ugly. But doing it _instead_ would not allow the format Ted wanted.

Show 8 quoted lines
> As to the unfortunate %gd that squats on the "date" other specifiers
> use, I do not see a good/quick approach to migrate it.  If our ideal
> short-term endgame before the longer format were to use %gd, %g# and
> %gg for the above three, we first start warning people who use %gd
> for the historical mistaken "reflog selector", while telling people
> to use "%gg@{%g#}" instead if they truly want "reflog selector", and
> then switch its meaning to "reflog date".  That would take a long
> time.
I don't think it's worth the deprecation effort and confusion.
> As %r prefix is not taken, we can immediately deprecate %g-anything
> format as a historical mistake and make sure we do not repeat the
> mistake of giving "d" to "reflog selector", perhaps?

Moving to "%r" as a more sensible prefix for "reflog", while cleaning up historical mistakes, is more appealing. But if we really are planning to move to "%(reflog-*)", then I think we can just forget about "%r" entirely.

I just don't think anybody has volunteered to work on %(reflog).
-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 20 in “pretty format string support for reflog times”
  1. pretty format string support for reflog timesPhil Pennock, Jul 27, 2016
  2. Phil PennockJul 27, 2016
  3. Jeff KingJul 27, 2016
  4. Phil PennockJul 27, 2016
  5. Junio C HamanoJul 27, 2016
  6. Jeff KingJul 27, 2016
  7. Junio C HamanoJul 27, 2016
  8. Jeff KingJul 27, 2016
  9. Junio C HamanoJul 27, 2016
  10. Jeff KingJul 27, 2016
  11. Jeff KingJul 27, 2016
  12. Phil PennockJul 27, 2016
  13. Jeff KingJul 27, 2016
  14. 0/2 t4205 style fixesJeff King, Jul 27, 2016
  15. 1/2 t4205: drop top-level &&-chainingJeff King, Jul 27, 2016
  16. 2/2 t4205: indent here documentsJeff King, Jul 27, 2016
  17. Junio C HamanoJul 27, 2016
  18. Jeff KingJul 27, 2016
  19. Phil PennockJul 27, 2016
  20. Jeff KingJul 27, 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.