Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

Re: [PATCH 2/4] log and rev-list: Fixed newline termination issues with --graph

From: Adam Simpkins <hidden>
Date: 2016-06-15 22:44:27

On Mon, Apr 07, 2008 at 10:43:09AM -0700, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
The main drawback is that dropping the automatic separator breaks
existing uses. We could work around this by automatically appending '%n'
if there is no use of "%n" or "%N",...
Yeah, I agree that sounds quite bad, and that is why I favor more explicit
and independent way to choose between separator and terminator (like the
"tformat" thing).
How about an extra option to explicitly toggle the separator on or
off?  For example, how about "--sep=<count>"?  Using --sep=0 would put
no separator between entries.  --sep=N would put N separators between
entries.

If this option isn't explicitly specified, the default should be
--sep=0 for ONELINE, and --sep=1 for everything else.  Using --sep=2
with USERFORMAT would achieve the behavior of getting an extra line of
padding between entries.


This still leaves unresolved the fact that the USERFORMAT output ends
with a missing newline in most cases.  I can see the argument for
doing this when using -z, which is primarily aimed for programmatic
consumption.  However, without -z, I don't think this is the behavior
most users expect.  For example, try running
"git --no-pager log -1 --pretty=format:%H".

If we were starting from scratch, and didn't have to worry about
breaking existing behavior, I would say that USERFORMAT should always
terminate entries in a newline, and then default to --sep=0.  As it
is, it might be easiest just to leave the current behavior, without a
terminating newline.

-- 
Adam Simpkins
adam@adamsimpkins.net
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help