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

Re: merge recursive and code movement

From
Jeff King <peff@peff.net>
Date
Mar 25, 2011, 10:12 UTC
Message-ID
<20110325101204.GB9047@sigill.intra.peff.net>
In-Reply-To
<20110325093758.GA9047@sigill.intra.peff.net>
On Fri, Mar 25, 2011 at 05:37:58AM -0400, Jeff King wrote:
Show 7 quoted lines
> It _almost_ works. The merge completes automatically, and the tweak ends
> up in foo.h, as you expect. But the merge silently deletes the
> placeholder revision.h!
> 
> I suspect it is a problem of merge-recursive either not handling the
> broken filepair properly, or perhaps reading too much into what a rename
> means. I haven't dug further.

Ah, found it. In process_renames, we explicitly call remove_file() on the source, which is assuming the rename did not come from a broken pair. What we actually want to do, I think, is to just take the changes from the renaming side literally. There's no point in doing a 3-way merge because the other side's changes will end up applied to the rename destination. It just happens that without break_opt, the renaming sides change is _always_ a deletion, or else it would not have been a rename candidate. So the current code is a special case for that rule.

Now, as far as how to do that, I haven't a clue. I've been staring at merge-recursive code for 30 minutes. ;)

-Peff
Previous: Jeff KingNext: Jeff King
Message 3 of 14 in “merge recursive and code movement”
  1. Jay SoffianMar 24, 2011
  2. Jeff KingMar 25, 2011
  3. Jeff KingMar 25, 2011
  4. Jeff KingMar 25, 2011
  5. Jeff KingMar 25, 2011
  6. 1/3 t3030: fix accidental success in symlink renameJeff King, Mar 25, 2011
  7. Junio C HamanoMar 25, 2011
  8. Jeff KingMar 25, 2011
  9. Schalk, KenMar 25, 2011
  10. 2/3 merge: handle renames with replacement contentJeff King, Mar 25, 2011
  11. 3/3 merge: turn on rewrite detectionJeff King, Mar 25, 2011
  12. Jay SoffianMar 25, 2011
  13. Techlive ZhengJul 16, 2012
  14. Jeff KingJul 16, 2012

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.