git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Phil Pennock <phil@pennock-tech.com>,
	Theodore Ts'o <tytso@mit.edu>,
	git@vger.kernel.org,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] pretty format string support for reflog times
Date: Wed, 27 Jul 2016 14:17:26 -0400	[thread overview]
Message-ID: <20160727181725.GD32219@sigill.intra.peff.net> (raw)
In-Reply-To: <xmqqfuqvvtph.fsf@gitster.mtv.corp.google.com>

On Wed, Jul 27, 2016 at 11:09:30AM -0700, Junio C Hamano wrote:

> 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.

> 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

  reply	other threads:[~2016-07-27 18:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27  8:14 [PATCH] pretty format string support for reflog times Phil Pennock
2016-07-27 12:02 ` Phil Pennock
2016-07-27 13:58 ` Jeff King
2016-07-27 14:17   ` Phil Pennock
2016-07-27 17:18   ` Junio C Hamano
2016-07-27 17:39     ` Jeff King
2016-07-27 18:09       ` Junio C Hamano
2016-07-27 18:17         ` Jeff King [this message]
2016-07-27 17:46     ` Junio C Hamano
2016-07-27 17:58       ` Jeff King
2016-07-27 17:56 ` Jeff King
2016-07-27 18:13   ` Phil Pennock
2016-07-27 18:32     ` Jeff King
2016-07-27 18:41       ` Phil Pennock
2016-07-27 19:16         ` Jeff King
2016-07-27 18:52       ` [PATCH 0/2] t4205 style fixes Jeff King
2016-07-27 18:55         ` [PATCH 1/2] t4205: drop top-level &&-chaining Jeff King
2016-07-27 18:55         ` [PATCH 2/2] t4205: indent here documents Jeff King
2016-07-27 19:28           ` Junio C Hamano
2016-07-27 19:57             ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160727181725.GD32219@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=phil@pennock-tech.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).