bug-patch
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-patch] Re: [PATCH] 'diff3 -m' style merge conflicts


From: Andreas Gruenbacher
Subject: [bug-patch] Re: [PATCH] 'diff3 -m' style merge conflicts
Date: Tue, 29 Dec 2009 17:29:14 +0100
User-agent: KMail/1.12.2 (Linux/2.6.31.5-0.1-desktop; KDE/4.3.1; i686; ; )

Bert,

On Wednesday 25 November 2009 01:05:57 Bert Wesarg wrote:
> Add support to emit merge conflicts like the 'GNU diff3' tool.

thanks for getting the ball rolling on this.

The proposed patch had a number of bugs (most notably it broke line number 
counting).  I decided to (re)implement this from scratch in the end.  Could 
you please have a look at the latest patch snapshot?


> Also, I think the test in line 170 of tests/merge shows a wrong behavior of
> 'patch --merge'.  I have added the output of 'diff3 -m' into the file as an
> reference.

That's arguable: patch sees the following diff:

        --- 2
        +++ 3
        @@ -1 +1 @@
        -1
        +a

and the file to patch (let's call it 1) contains one line:

        c

Diff3 gets all three input files and so it can produce the "desired" output:

        <<<<<<< 1
        c
        ||||||| 2
        1
        =======
        b
        >>>>>>> 3

Patch has no way to know that not c is supposed to be part of the conflict, 
and so it produces this:

        <<<<<<<
        |||||||
        1
        =======
        b
        >>>>>>>
        c

The <<<<<<< section could contain any number of lines from file 1; with the 
information given, all those solutions are correct.  The chosen heuristic 
keeps conflict sections as short as possible.

Thanks,
Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]