Re: [PATCH] pretty: add format specifiers for short and raw date formats
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 7, 2015, 20:22 UTC
- Message-ID
- <xmqqmvvutone.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1444235305-8718-1-git-send-email-szeder@ira.uka.de>
SZEDER Gábor <szeder@ira.uka.de> writes:
Show 6 quoted lines
> @@ -120,6 +120,8 @@ The placeholders are: > - '%at': author date, UNIX timestamp > - '%ai': author date, ISO 8601-like format > - '%aI': author date, strict ISO 8601 format > +- '%as': author date, short format > +- '%aR': author date, raw format
Hmmm, are these two a good things the only ones that are missing?
It makes me wonder if it's time for us to move to a more extensible format, e.g. "%aT(...)", in which 'T' stands for 'timestamp' and the part in the parentheses can be any format string that is understood by "log --date=<format>" [*1*]. Once we have something like that, we can keep the existing ones for historical convenience, stop adding new ones [*2*] and do not have to worry about these two mechanisms going out of sync.
Also, "%at" is almost there as a replacement for "%aR"; what we are missing really is "%aZ" for zone offset. If we had "%aZ", we do not need "%aR", as that is "%at %aZ".
[Footnote]
*1* Yes, and in longer term, we should really aim to unify the
for-each-ref format and "--pretty=format:" format. "%aT(...)"
is probably a step in a wrong direction, and it should probably
be more like "%(authordate:...)".*2* Because we have "%ad", we _can_ stop adding new ones already.