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

[PATCH 0/2] Reorganize read-tree

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Aug 31, 2005, 03:48 UTC
Message-ID
<Pine.LNX.4.63.0508302317380.23242@iabervon.org>

I got mostly done with this before Linus mentioned the possibility of having multiple index entries in the same stage for a single path. I finished it anyway, but I'm not sure that we won't want to know which of the common ancestors contributed which, and, if some of them don't have a path, we wouldn't be able to tell. The other advantages I see to this approach are:

 - it uses the more common parser of tree objects, moving toward having
   only one (diff-cache still uses read_tree(), however).
 - it doesn't need to do very complicated things with the index; the
   original read-tree does a bunch of stuff with an index with a gap in
   the middle containing obsolete entries.
 - it uses a much simpler method of finding directory/file conflicts,
   which is possible because the struct trees represent directories as
   well as files.
 - it deals with each path completely before going on to the next one,
   instead of first dealing with each input tree and then dealing with
   each path.
 - it removes a lot of intimate knowledge of the index structure from the
   program.

The general idea is that it figures out what trees you want, and then iterates through the entry lists together, recursing into directories, and calls the merge function with an array of the index entries (not yet added) for the path in each tree; the merge function adds the appropriate things to the index.

Note that this set doesn't include calling merge functions with multiple ancestors or remotes; that can be done when we've decided on whether my version of read-tree is worth using.

There are various potential refinements, plus removing a bunch of memory leaks, still to do, but I think this is sufficiently close to review.

(Refinements: it ought to have two indices in memory, the old and the new, and never modify the old and only append to the new, to simplify things further; it ought to use a sentinal value for the index entry to indicate that there is something in the tree to conflict with there being a file at the given path; the --emu23 logic could be clearer)

The first patch adds a few functions to the object library. The second patch changes read-tree around; It is essentially a rewrite, except for the merge functions and main().

	-Daniel
*This .sig left intentionally blank*
Next: Daniel Barkalow
Message 1 of 11 in “Reorganize read-tree”
  1. 0/2 Reorganize read-treeDaniel Barkalow, Aug 31, 2005
  2. 1/2 Object model additions for read-treeDaniel Barkalow, Aug 31, 2005
  3. Change read-tree to merge before using the index.Daniel Barkalow, Aug 31, 2005
  4. Junio C HamanoAug 31, 2005
  5. Daniel BarkalowAug 31, 2005
  6. Catalin MarinasAug 31, 2005
  7. Daniel BarkalowAug 31, 2005
  8. 1/2 Object model additions for read-treeDaniel Barkalow, Aug 31, 2005
  9. 2/2 Change read-tree to merge before using the index.Daniel Barkalow, Aug 31, 2005
  10. Junio C HamanoSep 5, 2005
  11. Daniel BarkalowSep 5, 2005

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.