From: Stefan Sperling Subject: Re: use patience diff for some diff3 merges To: gameoftrees@openbsd.org Date: Wed, 16 Jun 2021 11:05:22 +0200 On Thu, Jun 10, 2021 at 06:07:51PM +0200, Stefan Sperling wrote: > While using 'got histedit' I have encountered another mis-merge where > a change was dropped from history which shouldn't have been dropped. > I could reproduce this in 'got cherrypick' as well, by cherry-picking > the affected commit from my local 'packcreate' branch to 'main'. > > This particular problem disappears when diff3 uses the Patience diff > algorithm instead of the Myers algorithm to perform the merge. Thinking about this some more, we will probably want to investigate the 'recursive' merge Git is using. In addition to providing knobs for the diff algorithm, Git's recursive merge performs a merge of common ancestors first if there is no single definite common ancestor. This is something we could implement in Got, too. Apparently this avoids merge conflicts and mis-merges. Provided the merge of the common ancesors is conflict-free, of course. Otherwise, Git falls back on a regular 3-way merge of the given input files. For now, I'd still like to go forward with the proposed switch to Patience diff for cherrypick/backout/rebase/histedit. It will not be the perfect solution. There might still be other cases where the merge result contains something unexpected. But so far the only problem I've seen is that conflict chunks can be a bit large. Which is not really an issue since more lines of context can also help to figure out how to resolve the conflict. Any objections?