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

Re: A few usability question about git diff --cached

From
DTDavid Tweed <david.tweed@gmail.com>
Date
Oct 5, 2007, 05:22 UTC
Message-ID
<e1dab3980710042222u3e1fc21dtf4b90056fb36eaf0@mail.gmail.com>
In-Reply-To
<vpqtzp7ndn3.fsf@bauges.imag.fr>
On 10/4/07, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
Show 10 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> It makes more sense to me.
>
> For me, a "cache" is a fast-access copy of something, that I can
> rebuild at any time. Cache should be only a matter of performance, if
> the "cache" for an application changes its functionality, it means the
> cache has been too optimistic. Git's index is not that, "git add"
> means "add this to the index", which itself means "put that in the
> list of things to commit", and not "get a copy of that to work faster
> with it".

Just to say this interpretation is also the natural interpretation I have for the term "cached", and it confused me no end when I was first learning about git that the index was referred to as a cache. To be fair, git the documentation was in flux at that time and it's now referred too as a cache in very few places now.

An example of the kind of thing I have to think carefully about even now, Junio said in a different mail:

"--cached means work only on the "cached information in index."

If I understand correctly, the term "cached information in index" is more correctly "stored information in index" (or perhaps more technically "staged information in index") since there may be information in there which isn't a cache because it's no longer present anywhere else (ie, not in a commit yet but also changed in the working tree).

It's not a big thing, but the usage of cached in git still quite confuses me.
-- 
cheers, dave tweed__________________________
david.tweed@gmail.com
Rm 124, School of Systems Engineering, University of Reading.
"we had no idea that when we added templates we were adding a Turing-
complete compile-time language." -- C++ standardisation committee
Previous: Matthieu MoyNext: Wincent Colaiuta
Message 19 of 20 in “A few usability question about git diff --cached”
  1. Paolo CiarrocchiOct 4, 2007
  2. Wincent ColaiutaOct 4, 2007
  3. Miles BaderOct 5, 2007
  4. Wincent ColaiutaOct 5, 2007
  5. Miles BaderOct 5, 2007
  6. Miklos VajnaOct 4, 2007
  7. Paolo CiarrocchiOct 4, 2007
  8. Junio C HamanoOct 4, 2007
  9. Paolo CiarrocchiOct 4, 2007
  10. Wincent ColaiutaOct 4, 2007
  11. Johannes SchindelinOct 4, 2007
  12. Junio C HamanoOct 4, 2007
  13. David KastrupOct 4, 2007
  14. Matthieu MoyOct 4, 2007
  15. J. Bruce FieldsOct 4, 2007
  16. Matthieu MoyOct 4, 2007
  17. J. Bruce FieldsOct 4, 2007
  18. Matthieu MoyOct 5, 2007
  19. David TweedOct 5, 2007
  20. Wincent ColaiutaOct 4, 2007

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.