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

Why isn't the index a tree?

From
RHRichard Hansen <rhansen@bbn.com>
Date
Aug 19, 2011, 21:24 UTC
Message-ID
<4E4ED49C.6050405@bbn.com>

I expected the index to be implemented something like a ref to a tree object (per stage) plus some stat()/assume-unchanged/etc. metadata. Instead, it appears to be a (sorted?) flat list of full paths with their associated SHA1s and metadata.

Is there a reason why each stage in the index isn't implemented as a tree?
If the index was a tree, I believe it would make several tasks easier:
   * you could easily get the diff between stage 1 and some arbitrary 
revision (e.g., git diff HEAD^^ :1:)
   * you could commit and checkout empty directories
   * you could use update-index --cacheinfo to directly insert/replace 
an entire subdirectory
   * etc.

Thanks, Richard

Next: Jon Seymour
Message 1 of 2 in “Why isn't the index a tree?”
  1. Richard HansenAug 19, 2011
  2. Jon SeymourAug 19, 2011

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.