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

Re: [RFC] git-add update with all-0 object

From
APAndy Parkins <andyparkins@gmail.com>
Date
Dec 1, 2006, 09:37 UTC
Message-ID
<200612010937.08468.andyparkins@gmail.com>
In-Reply-To
<Pine.LNX.4.64.0612010223010.20138@iabervon.org>
On Friday 2006 December 01 08:10, Daniel Barkalow wrote:
> My position on this subject is that "index" is a good name, but that
> description is a terrible description, and "index" is a word that needs a
> good description in context. If we just said up front:

If we need to explain what "index" means in the context of diff then it's not a good name :-)

An index /everywhere else/ is a lookup table. topic->page number; author->book title. record id->byte position. There is never any content in an index, indices just point at content.

I imagine that's how git's index got it's name. (I'm only guessing as I've not looked at what's actually inside git's "index"). Here's my guess:

git update-index file1 hashes file1, stores it somewhere under that hash and writes the hash->filename connection to .git/index. That is why git's index is called an index. It's a hash->filename index.

Unfortunately, "index" in colloquial git actually means the combination of .git/index plus the hashed file itself. That's no longer an index, it's a "book". :-)

It's made worse, I think, by the fact that git doesn't want to do any index-like things with the "index". Being content-oriented rather than name-oriented means that an entry like "file1->NOTHING" is impossible in git. This leads to the sort of "git-add means track this filename" confusion that turns up a lot with new users.

It's probably all too late to change the nomenclature, but I've always been of the opinion that names are important, they confer meaning. When we use a common word, with common meaning and deviate from that common meaning we are bound to create confusion. New users don't have any "git-way-of-thinking" knowledge when they begin, so when they hear "index" they can only fall back on their standard understanding of that word. We shouldn't be surprised then when new users don't get "the index".

Andy
-- 
Dr Andy Parkins, M Eng (hons), MIEE
Previous: Daniel BarkalowNext: Jakub Narebski
Message 13 of 15 in “[RFC] git-add update with all-0 object”
  1. Daniel BarkalowNov 30, 2006
  2. Johannes SchindelinNov 30, 2006
  3. Nicolas PitreNov 30, 2006
  4. Jakub NarebskiNov 30, 2006
  5. Nicolas PitreNov 30, 2006
  6. Linus TorvaldsNov 30, 2006
  7. Daniel BarkalowDec 1, 2006
  8. Theodore TsoDec 1, 2006
  9. Junio C HamanoDec 1, 2006
  10. Jakub NarebskiDec 2, 2006
  11. Linus TorvaldsDec 1, 2006
  12. Daniel BarkalowDec 1, 2006
  13. Andy ParkinsDec 1, 2006
  14. Jakub NarebskiDec 2, 2006
  15. Jakub NarebskiDec 2, 2006

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.