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

git-log --format missing trailing newline character

From
ACAlejandro Colomar <alx@kernel.org>
Date
Dec 23, 2024, 20:28 UTC
Message-ID
<cw7vyas4yw2q4lqiskbvil7mpkx5l5qilj25vnqzkrp5nuezrx@d6tsavm3ajzw>
Hi!

I'm having trouble scripting around git-log(1), due to a missing newline character at the end of the file.

	$ git -v
	git version 2.45.2
	$ git log --format=format:'%H' HEAD^^^..HEAD | wc -l
	2
	$ git log --format=format:'%H' HEAD^^^..HEAD
	2ff431ab1b46a25088fe40baf1faf35ea9fac722
	e75e6c4504022ae52d877926e63c908d9572088a
	178442837d39560a789a8044a8eb90fde3ad7cd7

Would you mind fixing this bug? POSIX requires that text files end in a newline character, precisely for being able to use UNIX tools to process output from arbitrary commands.

Have a lovely night! Alex

-- 
<https://www.alejandro-colomar.es/>
Next: Kristoffer Haugsbakk
Message 1 of 7 in “git-log --format missing trailing newline character”
  1. Alejandro ColomarDec 23, 2024
  2. Kristoffer HaugsbakkDec 23, 2024
  3. Alejandro ColomarDec 23, 2024
  4. Andreas SchwabDec 23, 2024
  5. Alejandro ColomarDec 23, 2024
  6. Junio C HamanoDec 26, 2024
  7. Alejandro ColomarDec 26, 2024

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.