From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jakub Narebski <jnareb@gmail.com>
Cc: Davide Libenzi <davidel@xmailserver.org>, git@vger.kernel.org
Subject: Re: [PATCH] xdiff: add xdl_merge() (was: (unknown))
Date: Wed, 22 Nov 2006 10:29:55 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.63.0611221005470.30004@wbgn013.biozentrum.uni-wuerzburg.de> (raw)
In-Reply-To: <ek0170$h53$1@sea.gmane.org>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 4033 bytes --]
Hi,
On Wed, 22 Nov 2006, Jakub Narebski wrote:
> Johannes Schindelin wrote:
>
> > [PATCH] xdiff: add xdl_merge()
>
> Shouldn't this be in the subject of message?
Did I mention that I was tired and hungry?
> > This new function implements the functionality of RCS merge, but
> > in-memory. It returns < 0 on error, otherwise the number of conflicts.
>
> Only RCS merge, or can you implement whole diff3 (from GNU diffutils)
> functionality with that?
As I am interested only in the in-memory merge, only RCS merge. Which
feature would you be interested in? An ed script? :-)
> > Finding the conflicting lines can be a very expensive task. You can
> > control the eagerness of this algorithm:
> >
> > - a level value of 0 means that all overlapping changes are treated
> > as conflicts,
> > - a value of 1 means that if the overlapping changes are identical,
> > it is not treated as a conflict.
> > - If you set level to 2, overlapping changes will be analyzed, so that
> > almost identical changes will not result in huge conflicts. Rather,
> > only the conflicting lines will be shown inside conflict markers.
> >
> > With each increasing level, the algorithm gets slower, but more accurate.
> > Note that the code for level 2 depends on the simple definition of
> > mmfile_t specific to git, and therefore it will be harder to port that
> > to LibXDiff.
>
> How it compares performance with RCS merge/GNU diff3?
Speedwise, I have no clue. It was enough work for a day.
Accuracywise: often I sent a patch (series) which was in my current git
tree (no topic branch), and Junio did some minor adjustments. I _hated_
the fact that RCS merge marked _all_ overlapping changes as conflicts,
even when there was just a minor correction here and there. And "git diff
--ours" does not help at all.
Here is where my implementation should help. With level 2, it will look
again at these conflicting regions, and only output the actual differences
as conflicts.
> It is really nice to have that. Bram Cohen (of Codeville, SCM built around
> sophisticated merge algorithm) wrote about recursive three-way merge in
> http://revctrl.org/CrissCrossMerge
>
> Recursive three-way merge _usually_ provides the right answer, however
> there are some edge cases. For example, conflict markers can be matched
> incorrectly, because they aren't given any special semantic meaning for
> the merge algorithm, and are simply treated as lines. In particular,
> there are (somewhat complicated) cases where the conflict markers of two
> unrelated conflicts get matched against each other, even though the
> content sections of them are totally unrelated.
>
> I'm not sure if he has specific examples, or is it just theoretical talk,
> but having built-in merge would certainly help revursive merge strategy
> (and perhaps also git-rerere).
It should be easy to construct such an example. However, the relevance in
practice is about zero.
Git was built from the beginning to aim to do a merge as good as possible,
but not perfect. There is no such thing as a perfect merge algorithm. You
will always be able to construct cases which are mismerged.
Thus, git takes the pragmatic approach and stops "early": merges work in
99% of the time, and in 99% of the remaining 1% the merge will fail so
that you know you have to fix it manually. (Take these numbers with a
grain of salt, please.) The advantage of stopping there is that we can
make it really fast.
You could probably raise the 99% to 99.5%, by implementing a "rebasing
merge", i.e. cherry-picking the branch-to-be-merged committing only in the
end (if there has not been any conflict). Obviously, this is slow as
Parnell's pitch[1].
As for git-rerere: I could not use it everywhere, because of some Perl
dependencies which I could not compile on some platforms. However, IMHO
git-rerere does not necessarily depend on merge being available in libgit.
Ciao,
Dscho
Footnote 1: http://www.physics.uq.edu.au/pitchdrop/pitchdrop.shtml
next prev parent reply other threads:[~2006-11-22 9:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-21 22:24 (unknown) Johannes Schindelin
2006-11-21 23:15 ` [PATCH] xdiff: add xdl_merge() (was: (unknown)) Jakub Narebski
2006-11-22 9:29 ` Johannes Schindelin [this message]
2006-11-22 19:58 ` [PATCH] xdiff: add xdl_merge() Ramsay Jones
2006-11-22 20:16 ` your mail Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.63.0611221005470.30004@wbgn013.biozentrum.uni-wuerzburg.de \
--to=johannes.schindelin@gmx.de \
--cc=davidel@xmailserver.org \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).