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

A shortcoming of the git repo format

From
HAH. Peter Anvin <hpa@zytor.com>
Date
Apr 27, 2005, 05:43 UTC
Message-ID
<426F2671.1080105@zytor.com>
Most of git's files are starting to converge toward an RFC822-like 
header with (tag, data) and a free-form section.  This is a good thing. 
  However, there is one problem with this, and that is that without 
knowing every possible tag, a program reading the git repository cannot 
safely tell what is a link to another git object and what is not.  When 
I did my repository conversion tools, I simply assumed any string of 20 
hexadecimal digits was a pointer, but this is probably a bad idea in the 
long run.

Additionally, there is the question of the handling of strings that may contain \n or even \0 (which may be necessary for some applications).

One solution to all of this would be to define a quoting standard for strings, and simply require that all free-format strings (like the author fields) or at least strings that match [0-9a-f]{20}, are always quoted.

I propose the following:
- Any string containing control characters or \ must be quoted;
- \xXX produces control characters; other characters following \ are 
verbatim.
Thus,
link 0123456789abcdef0123
... is a link to an object, whereas ...
string \0123456789abcdef0123
... is a string.

string1 This string begins with a space string2 This string has an embedded newline ("\x0a")

... are both valid strings; the first contains a leading space and the second an embedded newline.

I'll implement this and integrate it tomorrow.
	-hpa
Next: C. Scott Ananian
Message 1 of 29 in “A shortcoming of the git repo format”
  1. H. Peter AnvinApr 27, 2005
  2. C. Scott AnanianApr 27, 2005
  3. Linus TorvaldsApr 27, 2005
  4. H. Peter AnvinApr 27, 2005
  5. Dave JonesApr 27, 2005
  6. H. Peter AnvinApr 27, 2005
  7. Jon SeymourApr 27, 2005
  8. Linus TorvaldsApr 27, 2005
  9. Petr BaudisApr 27, 2005
  10. Linus TorvaldsApr 27, 2005
  11. The git repo formatBrian O'Mahoney, Apr 27, 2005
  12. H. Peter AnvinApr 27, 2005
  13. Tom LordApr 27, 2005
  14. H. Peter AnvinApr 27, 2005
  15. Linus TorvaldsApr 28, 2005
  16. Paul JacksonApr 28, 2005
  17. Tom LordApr 28, 2005
  18. Ryan AndersonApr 28, 2005
  19. Morgan SchweersApr 28, 2005
  20. Barry SilvermanApr 28, 2005
  21. Linus TorvaldsApr 27, 2005
  22. David A. WheelerApr 28, 2005
  23. David LangApr 28, 2005
  24. Daniel BarkalowApr 27, 2005
  25. H. Peter AnvinApr 27, 2005
  26. Daniel BarkalowApr 28, 2005
  27. H. Peter AnvinApr 28, 2005
  28. David WoodhouseApr 28, 2005
  29. Gerhard SchrenkApr 27, 2005

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.