From: Jeff King Date: Mon, 07 Apr 2008 13:17:29 GMT Subject: Re: [PATCH 2/4] log and rev-list: Fixed newline termination issues with --graph Message-ID: <20080407131728.GA20319@sigill.intra.peff.net> In-Reply-To: <7vwsnaoxlz.fsf@gitster.siamese.dyndns.org> On Mon, Apr 07, 2008 at 01:52:40AM -0700, Junio C Hamano wrote: > Some alternatives to specify terminator semantics I considered are: > [...] > The first one is what I suggested in the message, but it feels somewhat > hacky. I suspect that the second one would catch 99% of the cases, but it > is DWIM and it is known that DWIM can go wrong. I favor design along > the lines of (3) or (4), which I think would be much cleaner. How about: (5) There is no automagic terminator or separator for user formats. %n translates to a newline. %N translates to a newline, unless this is the final record, in which case it translates to the empty string. So: # oneline git log --pretty=format:'%h %s%n' # multiline git log --pretty=format:'%h%nSubject: %s%n%N' 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", but I think that DWIM won't work for formats which want a non-newline record separator. So maybe a %x/%X string to mean "separator / terminator" instead of building on newline. If one doesn't exist, we append "%x" to the format (to give oneline semantics). -Peff