Commit bc62ede807f0ad3a920fa1e8b05dd90cc8f5f289

Stefan Sperling 2021-02-26T17:31:35

use Myers diff instead of Patience diff when merging files with diff3 Myers diff tends to divide files into smaller diff chunks, while Patience diff attemps to maximize the size of diff chunks. Smaller diffs chunks generally result in a more managable presentation of merge conflicts.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/lib/diff3.c b/lib/diff3.c
index 837a0e0..6343f4f 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -223,7 +223,7 @@ diffreg(BUF **d, const char *path1, const char *path2)
 		goto done;
 
 	err = got_diffreg(&diffreg_result, f1, f2,
-	    GOT_DIFF_ALGORITHM_PATIENCE, 0, 1);
+	    GOT_DIFF_ALGORITHM_MYERS, 0, 1);
 	if (err)
 		goto done;