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

Re: [1.8.0] use 'stage' term consistently

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
May 6, 2012, 10:39 UTC
Message-ID
<vpqtxztlhjd.fsf@bauges.imag.fr>
In-Reply-To
<201205061221.29592.jnareb@gmail.com>
Jakub Narebski <jnareb@gmail.com> writes:
> Actually Git porcelain does use 'the index' as a cache (computing),
> i.e. as a place to store redundant information (stat data, sha-1
> for trees with DIRC dircache extension) for faster access.

This is an implementation optimization, that is not supposed to be visible for the user. Commands refering to the "cache" are not about stat data cache (e.g. "git diff --cached" is really about the content, not the stat cache).

Show 11 quoted lines
>> index: an 'index' is a guide of pointers to something else; a book
>> index has a list of entries so the reader can locate information
>> easily without having to go through the whole book. Git porcelain is
>> not using the staging area to find out entries quicker; it's not an
>> index.
>
> Actually 'the index' is index in that sense; it stores _references_
> from filename to file contents, using SHA-1 identifier of a file/tree 
> contents in place of page number in the book index.  The SHA-1 
> identifier of object which is stored in database of repository, not the 
> index itself.

The implementation is done like this, but the user doesn't really care about this. For example, git-add(1) says "The index holds a snapshot of the content of the working tree", not "The index holds a set of references to sha1sums".

There's no need to expose these two implementation details in the terminology used in the interface. Indeed, I've often seen people from other VCS confused by Git's index just because of the terminology. Because we sometimes call it "cache", they think it is basically a stat-cache, and wonder why it is shown to the user. I've even seen Git users think that others VCS didn't have a stat-cache because they had read that the "cache" was a unique Git feature.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Jakub NarebskiNext: Felipe Contreras
Message 7 of 34 in “[1.8.0] use 'stage' term consistently”
  1. Felipe ContrerasMay 5, 2012
  2. Philip OakleyMay 5, 2012
  3. Felipe ContrerasMay 5, 2012
  4. Philip OakleyMay 5, 2012
  5. Zbigniew Jędrzejewski-SzmekMay 6, 2012
  6. Jakub NarebskiMay 6, 2012
  7. Matthieu MoyMay 6, 2012
  8. Felipe ContrerasMay 6, 2012
  9. Jakub NarebskiMay 6, 2012
  10. Junio C HamanoMay 8, 2012
  11. Felipe ContrerasMay 6, 2012
  12. Matthieu MoyMay 6, 2012
  13. Felipe ContrerasMay 6, 2012
  14. Ævar Arnfjörð BjarmasonMay 6, 2012
  15. Junio C HamanoMay 7, 2012
  16. Ævar Arnfjörð BjarmasonMay 7, 2012
  17. Junio C HamanoMay 8, 2012
  18. Ævar Arnfjörð BjarmasonMay 8, 2012
  19. Junio C HamanoMay 8, 2012
  20. Felipe ContrerasMay 9, 2012
  21. Matthieu MoyMay 9, 2012
  22. Mark LodatoMay 19, 2012
  23. Jonathan NiederMay 19, 2012
  24. Jonathan NiederMay 19, 2012
  25. Felipe ContrerasMay 20, 2012
  26. Jonathan NiederMay 20, 2012
  27. Philip OakleyMay 19, 2012
  28. Felipe ContrerasMay 20, 2012
  29. Jonathan NiederMay 20, 2012
  30. Junio C HamanoMay 20, 2012
  31. Felipe ContrerasMay 21, 2012
  32. Jonathan NiederMay 21, 2012
  33. Thiago FarinaMay 18, 2012
  34. Sebastien DoucheMay 8, 2012

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.