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

Re: Possible BUG in 'git log -z' last commit is not '\0' terminated

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 22, 2007, 21:56 UTC
Message-ID
<alpine.LFD.0.98.0706221451570.3593@woody.linux-foundation.org>
In-Reply-To
<e5bfff550706221227x4b785698taabfa7572bf8204b@mail.gmail.com>
On Fri, 22 Jun 2007, Marco Costalba wrote:
>
> It seems '-z' option is not honoured by the last revision printed that
> is just '\n' terminated.
It's not a bug - it's by design.

What the -z option does is to replace the normal "\n" that delineates commits from each other with a "\0".

And we only put that delimeter in *between* commits, not *after* commits. The reason? It's prettier. Do a

	git log -1

to get a single commit, and notice how we do *not* add an empty line at the end (or beginning), and compare that to

	git log -2
that shows two commits, and has an empty line in *between*.

Now, add the "-z" flag, and notice how that empty line is now replaced by a "\0" character instead.

So you should think of the "\0" as being a delimeter that goes between commits, not something that "ends" the commit. It's not a "end of record" thing, it's a "between records" thing.

		Linus
Previous: Junio C HamanoNext: Marco Costalba
Message 3 of 4 in “Possible BUG in 'git log -z' last commit is not '\0' terminated”
  1. Marco CostalbaJun 22, 2007
  2. Junio C HamanoJun 22, 2007
  3. Linus TorvaldsJun 22, 2007
  4. Marco CostalbaJun 23, 2007

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.