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

Re: RFH: refactor read-tree

From
Linus Torvalds <torvalds@osdl.org>
Date
Jul 9, 2006, 03:15 UTC
Message-ID
<Pine.LNX.4.64.0607082011060.5623@g5.osdl.org>
In-Reply-To
<Pine.LNX.4.63.0607090015250.29667@wbgn013.biozentrum.uni-wuerzburg.de>
On Sun, 9 Jul 2006, Johannes Schindelin wrote:
Show 9 quoted lines
> 
> I also played a little with git-merge-tree, because it seems so much 
> simpler and easier to refactor. But there is a problem: Either I call it 
> the wrong way, or it does not yet work correctly: I tried
> 
> 	git-merge-tree $(git-merge-base branch1 branch2) branch1 branch2
> 
> with what is in 'next'. But it only showed the _new_ files, not the 
> modified ones.
What git-merge-tree does is to show the _difference_ to "branch1".

So if the result of the merge would be totally identical to "branch1", then git-merge-tree should be totally silent.

The basic idea is that "branch1" should be your current branch, and it obviously is also expected to match (more or less) the current index. So you can do a merge by

 - reading in "branch1" into the index:
	GIT_INDEX_FILE=.git/tmp-index git-read-tree -m branch1
 - doing a "git-merge-tree $base $branch1 $branch2"
 - using the _result_ of "git-merge-tree" to modify the index you just 
   read in.
 - write out the end result as the result of the merge.

And yes, I agree 100% that "git-read-tree" has become an unholy mess. I looked at it, and I think it's unfixable. I considered re-writing it from scratch, at least for some specific cases, but I couldn't bring myself to do it.

			Linus
Previous: Johannes SchindelinNext: Alex Riesen
Message 2 of 7 in “RFH: refactor read-tree”
  1. Johannes SchindelinJul 8, 2006
  2. Linus TorvaldsJul 9, 2006
  3. Alex RiesenJul 9, 2006
  4. Johannes SchindelinJul 9, 2006
  5. Linus TorvaldsJul 9, 2006
  6. Alex RiesenJul 9, 2006
  7. Johannes SchindelinJul 9, 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.