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

Re: [PATCH] Add --show-size to git log to print message size

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jul 15, 2007, 18:14 UTC
Message-ID
<alpine.LFD.0.999.0707151110520.20061@woody.linux-foundation.org>
In-Reply-To
<e5bfff550707150529l7e9bdd9fu253d38f99d4d2ed7@mail.gmail.com>
On Sun, 15 Jul 2007, Marco Costalba wrote:
Show 6 quoted lines
>
> To further push for git patch, please check this from current linux tree:
> 
> git log --parents --pretty=raw -z -r -p c4201214
> 
> As you can see the diff contains a '\0' value (actually removed by the patch).

So arguably maybe we should have turned that patch into a binary patch, but then it would have been really hard to read, and GNU patch and friends couldn't have read it.

So I think a better option would be:
> qgit of course fails, as any tool based on parsing '\0' delimiting
> character records. If the size of the patch was explicitly given
> instead no fail will occur.

You have an alternate fix, namely to only look at the NUL character at newline boundaries. Also, when it comes to "git log", you actually know even more: each commit begins with "commit".

A patch will always be nicely line-oriented, and will never have a NULL at the *beginning* of a line.

So you could actually make the parsing really strict, and look for the sequence

	'\n\0commit '
and that's a very trustworthy delimeter.
But yes, you can have NUL-characters in the middle of patches.
		Linus
Previous: Marco CostalbaNext: Marco Costalba
Message 17 of 29 in “Add --show-size to git log to print message size”
  1. Add --show-size to git log to print message sizeMarco Costalba, Jul 14, 2007
  2. Junio C HamanoJul 14, 2007
  3. Marco CostalbaJul 14, 2007
  4. Alex RiesenJul 15, 2007
  5. Marco CostalbaJul 15, 2007
  6. Alex RiesenJul 15, 2007
  7. Marco CostalbaJul 15, 2007
  8. Marco CostalbaJul 15, 2007
  9. SeanJul 15, 2007
  10. Marco CostalbaJul 15, 2007
  11. SeanJul 15, 2007
  12. Marco CostalbaJul 15, 2007
  13. SeanJul 15, 2007
  14. Marco CostalbaJul 15, 2007
  15. SeanJul 15, 2007
  16. Marco CostalbaJul 15, 2007
  17. Linus TorvaldsJul 15, 2007
  18. Marco CostalbaJul 15, 2007
  19. Marco CostalbaJul 16, 2007
  20. Alex RiesenJul 16, 2007
  21. Junio C HamanoJul 16, 2007
  22. Marco CostalbaJul 16, 2007
  23. Marco CostalbaJul 16, 2007
  24. Junio C HamanoJul 16, 2007
  25. Marco CostalbaJul 16, 2007
  26. Andy ParkinsJul 17, 2007
  27. Marco CostalbaJul 17, 2007
  28. Junio C HamanoJul 25, 2007
  29. Marco CostalbaJul 25, 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.