git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: David Srbecky <dsrbecky@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Why is the name of a blob SHA1("$type $size\0$data") and not SHA1("$data")?
Date: Fri, 1 May 2009 00:57:33 +0200	[thread overview]
Message-ID: <20090430225733.GC18940@atjola.homenet> (raw)
In-Reply-To: <49FA0214.70009@gmail.com>

On 2009.04.30 20:55:00 +0100, David Srbecky wrote:
> 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 :-)

Yes, at least the type is pretty important. Consider just "git show
$some_object_name". If the object name was just the hash of the
contents, you could have a blob and a commit with the same name. Which
is which? And which do you mean in that command? The command line
interface would need to accept a type in addition to the object name in
a lot of place.

And in packs, you want the objects ordered so that you get could access
patterns, and don't read from all over the pack file. That means that
you would need the type header there, regardless of whether it is in the
loose object file.

Björn

      parent reply	other threads:[~2009-04-30 22:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 19:55 Why is the name of a blob SHA1("$type $size\0$data") and not SHA1("$data")? David Srbecky
2009-04-30 20:02 ` Shawn O. Pearce
2009-04-30 22:57 ` Björn Steinbrink [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090430225733.GC18940@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=dsrbecky@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).