bug-diffutils
[Top][All Lists]
Advanced

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

[bug-diffutils] bug#29510: 3-way merge, diff3 lacking features


From: Lluís Batlle i Rossell
Subject: [bug-diffutils] bug#29510: 3-way merge, diff3 lacking features
Date: Thu, 30 Nov 2017 14:54:21 +0100

Hello,

I've been using diff3 to do 3-way merges... and I failed to make it work
as I wanted, with properly bracketed conflicts. "git merge-file" works
much better. I wrote a summary where you can see how "git merge-file"
works better, only annotating the conflicting parts with full detail.
diff3 either brackets too much or it misses details.

Maybe I just fail to know how to operate diff3; please let me know.

Here goes the summary; "-----" lines means nonexistant. It is a screen capture
of vimdiff.

(web version: http://sprunge.us/hBjJ)

Source:

                 local.c                    base.c                   remote.c

  #include <stdio.h>      |  #include <stdio.h>      |  #include <stdio.h>
  ------------------------|  #include <stdlib.h>     |  ------------------------
                          |                          |
  int main()              |  int main()              |  int main()
  {                       |  {                       |  {
      echo 2;             |  ------------------------|      echo 1;
  }                       |  }                       |  }
  ------------------------|  ------------------------|
  ------------------------|  ------------------------|
  ------------------------|  ------------------------|
  ------------------------|  ------------------------|  #include <hola.h>


diff3 -m local.c base.c remote.c
============================================================
#include <stdio.h>
<<<<<<< base.c
#include <stdlib.h>
=======
>>>>>>> remote.c

int main()
{
<<<<<<< local.c
    echo 2;
||||||| base.c
=======
    echo 1;
>>>>>>> remote.c
}



#include <hola.h>
------------------------------------------------------------

diff3 -3 -m local.c base.c remote.c
============================================================
#include <stdio.h>

int main()
{
    echo 2;
}



#include <hola.h>

------------------------------------------------------------

diff3 -x -m local.c base.c remote.c
============================================================
#include <stdio.h>

int main()
{
    echo 1;
}
------------------------------------------------------------

diff3 -X -m local.c base.c remote.c
============================================================
#include <stdio.h>

int main()
{
<<<<<<< local.c
    echo 2;
=======
    echo 1;
>>>>>>> remote.c
}
------------------------------------------------------------

git merge-file -p local.c base.c remote.c
============================================================
#include <stdio.h>

int main()
{
<<<<<<< local.c
    echo 2;
||||||| base.c
=======
    echo 1;
>>>>>>> remote.c
}
------------------------------------------------------------

man diff3
============================================================
       -e, --ed
              output ed script incorporating changes from OLDFILE to  YOURFILE
              into MYFILE

       -E, --show-overlap
              like -e, but bracket conflicts

       -3, --easy-only
              like -e, but incorporate only nonoverlapping changes

       -x, --overlap-only
              like -e, but incorporate only overlapping changes

       -X     like -x, but bracket conflicts

       -i     append `w' and `q' commands to ed scripts

       -m, --merge
              output  actual  merged file, according to -A if no other options
              are given
------------------------------------------------------------


Regards,
Lluís.

-- 
(Escriu-me xifrat si saps PGP / Write ciphered if you know PGP)
PGP key 7CBD1DA5 - https://emailselfdefense.fsf.org/





reply via email to

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