Commit Diff


commit - 67157248154a23138c2b7ff2eebecbdf3d079ef7
commit + 6eef8e901214482037e02f490b9b11143a1bb9b8
blob - a286036a2ee2b4911b7aa95172020f4192c56f5d
blob + fa53edaad0014c7632d51f15b991cee18d7ee6d0
--- lib/diff_myers.c
+++ lib/diff_myers.c
@@ -383,6 +383,13 @@ diff_divide_myers_forward(bool *found_midpoint,
 		if (backwards_d < 0)
 			continue;
 
+		/* Will cut into smaller diff boxes only where a section of
+		 * similar lines (a snake) was seen. Otherwise this would
+		 * fragment sections of mismatching lines and mess up matching
+		 * those sections sanely. */
+		if (x_before_slide == x)
+			continue;
+
 		/* If both sides have the same length, forward and backward
 		 * start on the same diagonal, meaning the backwards state index
 		 * c == k.
@@ -675,6 +682,14 @@ diff_divide_myers_backward(bool *found_midpoint,
 		 */
 		if ((delta & 1) != 0)
 			continue;
+
+		/* Will cut into smaller diff boxes only where a section of
+		 * similar lines (a snake) was seen. Otherwise this would
+		 * fragment sections of mismatching lines and mess up matching
+		 * those sections sanely. */
+		if (x_before_slide == x)
+			continue;
+
 		/* Forwards was done first, now both d are the same. */
 		int forwards_d = d;
 
blob - 868a057dec4da8aeaacb365873c318d935909dd4
blob + b8b7a6acc58935c3b47389def681b070e3b280b1
--- test/expect010.diff
+++ test/expect010.diff
@@ -6,14 +6,14 @@
  
  /*
   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
-@@ -10979,6 +10979,10 @@
+@@ -10982,6 +10982,10 @@
+ 	    "RTL8192EU",
  	},
  	{
- 	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU,
++	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU_2,
 +	    "RTL8192EU",
 +	},
 +	{
-+	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU_2,
- 	    "RTL8192EU",
+ 	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8188EUS,
+ 	    "RTL8188EUS",
  	},
- 	{
blob - 7ad8f311b3e6e5853c922d92aad3509057bd52bd
blob + f647823b9300958e80110e7d19e2663b6208876f
--- test/expect011.diff
+++ test/expect011.diff
@@ -6,14 +6,14 @@
  
  /*
   * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
-@@ -375,6 +375,10 @@
+@@ -378,6 +378,10 @@
+ 	    "RTL8192EU",
  	},
  	{
- 	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU,
++	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU_2,
 +	    "RTL8192EU",
 +	},
 +	{
-+	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU_2,
- 	    "RTL8192EU",
+ 	    USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8188EUS,
+ 	    "RTL8188EUS",
  	},
- 	{