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

Why is the name of a blob SHA1("$type $size\0$data") and not SHA1("$data")?

From
DSDavid Srbecky <dsrbecky@gmail.com>
Date
Apr 30, 2009, 19:55 UTC
Message-ID
<49FA0214.70009@gmail.com>
Hi,

First of all, congratulations on makeing such a great version control system. I love the storage model - in comparison with other systems, it is just birantly simple and ingenious.

I started digging into the details and there is one thing that is really bugging me - why is the name of a blob SHA1("$type $size\0$data") and not SHA1("$data")? I mean, wouldn't it be beautiful if the name of the blob would really just be the SHA1 of the uncompressed file content? :-)

Furthermore, is the header really necessary? Wouldn't it be eqvivalently effective to put the blobs into own subdirectory? For example: .git\objects\blob\22\22a3d28c5b2fca0eae83be1a2ed619e357f6a1e6 So the blob would contatin just be the compressed content and nothing else - beautiful :-)

I would really appriciate some comments on the design decisions so that I can sleep well at night :-)

David
Next: Shawn O. Pearce
Message 1 of 3 in “Why is the name of a blob SHA1("$type $size\0$data") and not SHA1("$data")?”
  1. David SrbeckyApr 30, 2009
  2. Shawn O. PearceApr 30, 2009
  3. Björn SteinbrinkApr 30, 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.