Re: bug: git format prints no final newline

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

 



On Thu, Nov 03, 2022 at 02:14:37PM +1100, Evan Benn wrote:

> This command omits the final newline:
> 
> git log --format=format:"%H"

This is the intended behavior. See the section on "tformat:" in "git
help log", and the discussion of "terminator" vs "separator" semantics.

The "separator" semantics are helpful for most multiline formats (where
your separator is probably a blank line, and you don't want an extra one
at the end). Terminator is more useful for one-line outputs.

I think one could argue that the terminator one is what most people want
and would be a better default, but "format" is the way it is for
historical compatibility. If you use the do-what-I-mean form of:

  git log --format=%H

then it defaults to tformat (notice no "format:" or "tformat:" keyword;
we infer from the presence of "%H" in the name that it's a custom
format, and that is what defaults to tformat).

-Peff



[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