git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Missing trailing newline with git log --pretty=format

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 18, 2009, 22:27 UTC
Message-ID
<7vzlfibh5w.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200903182304.51387.agruen@suse.de>
Andreas Gruenbacher <agruen@suse.de> writes:
Show 5 quoted lines
> On Wednesday, 18 March 2009 22:56:43 Markus Heidelberg wrote:
>> Use tformat instead of format.
>
> Hmm ... didn't know that, thanks. Now I wonder why anyone would ever want 
> format instead of tformat ;)

If your payload is multi-line, you would want to see a separating empty line in between entries, but not after the last one:

	$ command with --format
        The first line of first entry.
        The second line of first entry.
        ...
        The last line of first entry.
        The first line of second entry.
        ...
        ...
        The last line of last entry.
        $ notice there is no extra newline after that

That is what --format does. One-line-per-entry is a special case. You do not want a "separating LF in between entries", but a "terminating LF after each entry". T in --tformat stands for this "terminating" aspect, as opposed to the "separator" behaviour --format gives you.

Previous: Andreas Gruenbacher
Message 4 of 4 in “Missing trailing newline with git log --pretty=format”
  1. Andreas GruenbacherMar 18, 2009
  2. Markus HeidelbergMar 18, 2009
  3. Andreas GruenbacherMar 18, 2009
  4. Junio C HamanoMar 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.