Useful explanation - thanks, Linus.

Is this picture and description accurate:

==============================================================


             < working directory files (foo.c) >
                           ^
  ^                        |
  |  upward ops            |            downward ops  |
  |  ----------            |            ------------  |
  | checkout-cache         |            update-cache  |
  | show-diff              |                          v
                           v
        < current directory cache (".dircache/index") >
                           ^
  ^                        |
  |  upward ops            |            downward ops  |
  |  ----------            |            ------------  |
  |   read-tree            |             write-tree   |
  |                        |            commit-tree   |
                           |                          v
                           v
< git filesystem (blobs, trees, commits: .dircache/{HEAD,objects}) >


==============================================================


The checkout-cache and show-diff ops read their meta-data from
the cache, and the actual file contents from the git filesystem.
Similary, the update-cache op writes meta-data into the cache,
and may create new files in the git filesystem.

The cache (but not the git filesystem) stores transient
information (ctime, mtime, dev, ino, uid, gid, and size)
about each working file update-cache has copied into the git
filesystem so that checkout-cache and show-diff can detect
changes in the contents of working files just from a stat,
without actually rereading the file.

In some sense, the cache holds the git filesystem inodes,
and the git filesystem holds the data blocks.  Except that:
  (1) the cache just holds the current "view" into the git
      filesystem,
  (2) objects in the filesystem have an "inode" number (their
      <sha1> value) that is persistent whether in view or not,
  (3) objects in the filesystem are not removed just because
      nothing in the cache references them,
  (4) objects in the filesystem can reference other objects,
      that are typically also in the filesystem, but that can
      still be reliably self-identified even if found in the
      wild of say one's email inbox, and
  (5) the view in the directory cache can itself be made into
      a filesystem object - using commit-tree.


==============================================================

Minor question:

  I must have an old version - I got 'git-0.03', but
  it doesn't have 'checkout-cache', and its 'read-tree'
  directly writes my working files.
 
  How do I get a current version?  Well, one way I see,
  and that's to pick up Pasky's:
    
    http://pasky.or.cz/~pasky/dev/git/git-pasky-base.tar.bz2
 
  Perhaps that's the best way?

-- 
                  I won't rest till it's the best ...
                  Programmer, Linux Scalability
                  Paul Jackson <[EMAIL PROTECTED]> 1.650.933.1373, 
1.925.600.0401
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to