Thread (6 messages) 6 messages, 3 authors, 2016-06-15

Re: feature suggestion: optimize common parts for checkout --conflict=diff3

From: Jeff King <hidden>
Date: 2016-06-15 22:56:19
Subsystem: the rest · Maintainer: Linus Torvalds

On Wed, Mar 06, 2013 at 08:26:57PM +0100, Antoine Pelisse wrote:
quoted
however the difference isn't that easy to spot any more. I expected

        diff --cc file
        index a07e697,5080129..0000000
        --- a/file
        +++ b/file
        @@@ -12,7 -12,7 +12,12 @@@
          12
          13
          14
        ++<<<<<<< ours
         +15
        ++||||||| base
        ++=======
        + 16
        ++>>>>>>> theirs
          17
          18
          19
This is not correct, it would mean that 12, 13, 14, 17, 18, 19 are in
base, while they are not.
Yeah, I agree it is a bit of a lie, as you are not seeing the full
picture of what was in the base. That is why we intentionally dial down
the conflict simplification level when using diff3. If you apply this
patch to git:
diff --git a/xdiff/xmerge.c b/xdiff/xmerge.c
index 9e13b25..f381e0c 100644
--- a/xdiff/xmerge.c
+++ b/xdiff/xmerge.c
@@ -420,15 +420,6 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1,
 	int style = xmp->style;
 	int favor = xmp->favor;
 
-	if (style == XDL_MERGE_DIFF3) {
-		/*
-		 * "diff3 -m" output does not make sense for anything
-		 * more aggressive than XDL_MERGE_EAGER.
-		 */
-		if (XDL_MERGE_EAGER < level)
-			level = XDL_MERGE_EAGER;
-	}
-
 	c = changes = NULL;
 
 	while (xscr1 && xscr2) {
then it will produce the output that Uwe expects. While it can be
misleading, I also think it can make some conflicts (like this one) much
easier to understand. I don't see any reason we can't have a "zealous
diff3" mode to let people view this output, as long as it is not the
default.

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help