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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux