all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Olivier Certner <ocert.dev@free.fr>
To: 59182@debbugs.gnu.org
Subject: bug#59182: 28.1; ediff: Merges with ancestor: Fix computation of hunks and proposed merge
Date: Thu, 10 Nov 2022 19:29:09 +0100	[thread overview]
Message-ID: <1855192.vslOlgHxSZ@ravel> (raw)

[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]

Hunks are not computed correctly because the diff3 command is
invoked with arguments in an incorrect order.  The correct order is
the local file first, the base (or "ancestor") second and the other
file third. 

This erroneous behavior has two consequences.  First, the
output of diff3 would change, since it tries to merge chunks according
to maximal matches between the second and first files, and the second
and third files.  Second, ediff, more precisely, `ediff-do-merge',
would consequently try to merge the reverse of the changes from the
base to the other file, leading to a hard to understand merge result in
some cases.

To see the effect on a simple example, consider what
`ediff-merge-with-ancestors` suggests on the three files attached (run
`ediff-merge-with-ancestor' with file A being 'local.txt', file B being
'other.txt' and file C being 'ancestor.txt').

I noticed this problem on a very hairy merge that I can't reproduce here.

Fix to be attached as soon as the bug is created.

-- 
Olivier Certner

[-- Attachment #2: local.txt --]
[-- Type: text/plain, Size: 10 bytes --]

4
5
1
2
3

[-- Attachment #3: ancestor.txt --]
[-- Type: text/plain, Size: 12 bytes --]

1
2
3
4
5
6

[-- Attachment #4: other.txt --]
[-- Type: text/plain, Size: 10 bytes --]

4
5
6
1
2

             reply	other threads:[~2022-11-10 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 18:29 Olivier Certner [this message]
2022-11-10 18:35 ` bug#59182: Proposed fix Olivier Certner
2022-11-17  9:41   ` Eli Zaretskii

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1855192.vslOlgHxSZ@ravel \
    --to=ocert.dev@free.fr \
    --cc=59182@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.