Subject: Re: [PATCH v4 0/5] cleanup ra/rebase-i-more-options

From: Junio C Hamano <[email-masked]>
Date: Wed, 27 May 2020 14:10:04 -0700

Phillip Wood <[email-masked]> writes:

>     -+	git log -1 --pretty="format:%ai" >authortime &&
>     ++	git log -1 --pretty=%ai >authortime &&

It probably wouldn't make too much of a difference in real life, but
I think "--format=%ai" is how the above is customary written.

Some history.

The --pretty="format:<string with per-cent placeholder>" came first,
with an explicit goal of giving us enough flexibility to mimick
canned "pretty print" formats like --pretty=medium, --pretty=short,
etc. (note: it was *not* part of the goal to actually replace the
implementation of canned formats with hardcoded set of placeholder
strings).

If you run "git log --pretty=medium -2", you'd observe that the
topmost commit is shown immediately without any preceding blank
line, then an extra blank line is shown, and then the second commit
is shown, and after that, the output ends without any extra blank
line.  With respect to the "extra blank line", we call this
"separator semantics"---an extra blank is given _between_ two items
that are shown.

Like "git log --pretty=medium", the "format:<custom>" pretty print
format uses the "separator semantics".  There is no "extra LF" after
showing the last item.

Of course, the "separator" behaviour was later found to be
cumbersome if we wanted to mimick "--pretty=oneline".  The payload
of each item in the oneline output format lacks the terminating LF,
so instead of an extra LF between two items, we want an extra LF
after every item.  This, in contrast to "separator" semantics, is
called "terminator" semantics and --pretty="tformat:<custom>" was
introduced to allow.

Later, when we introduced --format=<format>, we made it so that 

 (1) when <format> is equal to one of the canned format names,
     "--format=<format>" is equivalent to "--<format>".

 (2) otherwise, when <format> has placeholders, "--format=<format>"
     acts the same way as "--pretty=tformat:<format>".

as we found out that people are often using custom format that
consists of only one line of payload, quite often as a way to
extract a handful of "fields" from each commit object.

So given all of the above, the "let's grab the author-time in iso
format and nothing else from each commit object" in the above
excerpt from your test is the use case for which --format=%ai was
designed.