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

Re: [PATCH] merge-tree: fix "same file added in subdir"

From
John Keeping <john@keeping.me.uk>
Date
Mar 28, 2013, 09:34 UTC
Message-ID
<20130328093458.GV2286@serenity.lan>
In-Reply-To
<20130327225739.GT2286@serenity.lan>
On Wed, Mar 27, 2013 at 10:57:39PM +0000, John Keeping wrote:
Show 26 quoted lines
> On Wed, Mar 27, 2013 at 03:42:40PM -0700, Junio C Hamano wrote:
> > John Keeping <john@keeping.me.uk> writes:
> > 
> > > When the same file is added with identical content at the top level,
> > > git-merge-tree prints "added in both" with the details.  But if the file
> > > is added in an existing subdirectory, threeway_callback() bails out early
> > > because the two trees have been modified identically.
> > >
> > > In order to detect this, we need to fall through and recurse into the
> > > subtree in this case.
> > >
> > > Signed-off-by: John Keeping <john@keeping.me.uk>
> > 
> > The rationale the above description gives is internally consistent,
> > but it is rather sad to see this optimization go.  The primary
> > motivation behind this program, which does not use the usual
> > unpack-trees machinery, is to allow us to cull the identical result
> > at a shallow level of the traversal when the both sides changed (not
> > added) a file deep in a subdirectory hierarchy.
> > 
> > The patch makes me wonder if we should go the other way around,
> > resolving the "both added identically" case at the top cleanly
> > without complaint.
> 
> I don't use merge-tree so I have no opinion on this, just wanted to fix
> an inconsistency :-)

Having re-read the manpage, I think you're right that we should just resolve the "both added identically" case cleanly, but I wonder whether some of the other cases should also be resolved cleanly.

git-merge-tree(1) says:
    the output from the command omits entries that match the <branch1>
    tree.

so you could argue that "added in branch1", "changed in branch1, unmodified in branch2" and "removed in branch1, unchanged in branch2" should also print no output.

But as I said above I don't use git-merge-tree so perhaps people who do would like to explain what they expect in these cases.

Previous: John KeepingNext: Junio C Hamano
Message 4 of 8 in “merge-tree: fix "same file added in subdir"”
  1. merge-tree: fix "same file added in subdir"John Keeping, Mar 27, 2013
  2. Junio C HamanoMar 27, 2013
  3. John KeepingMar 27, 2013
  4. John KeepingMar 28, 2013
  5. Junio C HamanoApr 7, 2013
  6. merge-tree: don't print entries that match "local"John Keeping, Apr 7, 2013
  7. René ScharfeApr 27, 2013
  8. John KeepingApr 27, 2013

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.