On Mon, 8 Aug 2016 20:21:47 -0700 (PDT)
Sharan Basappa <sharan.basa...@gmail.com> wrote:

> > Well, there are exactly three types of objects in Git repos: blobs, 
> > trees and commits.  Files are stored as blobs.  Blobs have no "file 
> > names" attached to them; in fact, they keep no associated metadata
> > at all.  Since humans routinely manipulate data kept in files using 
> > hierarchical files systems, Git mirrors this approach by using tree 
> > objects.  A tree object serves the same purpose a directory does on
> > a file system: it maps human-defined names of the files to their
> > contents. So a tree object contains a set of entries -- each
> > representing a single file or a subdirectory.  Each entry has three
> > "fields" a (simplified) file mode, the hash value of the entry's
> > contents (its address, that is) and the human-friendly name --
> > taken from the source filesystem.  Subdirectory entries refer to
> > other tree objects and file entries refer to blobs. 
> So, all the 3 objects types are referenced by SHA hash
> values and searched using these values.
> This includes blobs, trees & commit objects. 

Yes, this is correct.

Git never uses names of files and directories as found in the work tree
to look up bits of data it stores.  Such lookups *do* happen -- say,
when you run something like

  git log -- path/to/some/file

but they happen like
1) ... Fetch the next commit object;
2) Fetch the root tree object it references,
   parse it to find an entry named "path", get its SHA-1 name.
3) Fetch a tree object figured out on step (2),
   parse it to find an entry named "to", ...
...and so on, so in the end the actual data is always looked up in the
object store using its SHA-1 name.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to