summaryrefslogtreecommitdiff
path: root/merge-ort.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2020-12-13 08:04:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-12-13 22:18:19 (GMT)
commitc8017176ac8fb5cc85ca8742bbdeec8943427340 (patch)
tree60a1c0a6f7e017d8f9c2f9bbe6839bb5d2b9e2c7 /merge-ort.c
parente4171b1b6d32a147638f52c3199477d3ea161b3e (diff)
downloadgit-c8017176ac8fb5cc85ca8742bbdeec8943427340.zip
git-c8017176ac8fb5cc85ca8742bbdeec8943427340.tar.gz
git-c8017176ac8fb5cc85ca8742bbdeec8943427340.tar.bz2
merge-ort: use histogram diff
In my cursory investigation, histogram diffs are about 2% slower than Myers diffs. Others have probably done more detailed benchmarks. But, in short, histogram diffs have been around for years and in a number of cases provide obviously better looking diffs where Myers diffs are unintelligible but the performance hit has kept them from becoming the default. However, there are real merge bugs we know about that have triggered on git.git and linux.git, which I don't have a clue how to address without the additional information that I believe is provided by histogram diffs. See the following: https://lore.kernel.org/git/20190816184051.GB13894@sigill.intra.peff.net/ https://lore.kernel.org/git/CABPp-BHvJHpSJT7sdFwfNcPn_sOXwJi3=o14qjZS3M8Rzcxe2A@mail.gmail.com/ https://lore.kernel.org/git/CABPp-BGtez4qjbtFT1hQoREfcJPmk9MzjhY5eEq1QhXT23tFOw@mail.gmail.com/ I don't like mismerges. I really don't like silent mismerges. While I am sometimes willing to make performance and correctness tradeoff, I'm much more interested in correctness in general. I want to fix the above bugs. I have not yet started doing so, but I believe histogram diff at least gives me an angle. Unfortunately, I can't rely on using the information from histogram diff unless it's in use. And it hasn't been used because of a few percentage performance hit. In testcases I have looked at, merge-ort is _much_ faster than merge-recursive for non-trivial merges/rebases/cherry-picks. As such, this is a golden opportunity to switch out the underlying diff algorithm (at least the one used by the merge machinery; git-diff and git-log are separate questions); doing so will allow me to get additional data and improved diffs, and I believe it will help me fix the above bugs at some point in the future. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'merge-ort.c')
-rw-r--r--merge-ort.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/merge-ort.c b/merge-ort.c
index fb07c8f..85942cf 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -21,6 +21,7 @@
#include "diffcore.h"
#include "strmap.h"
#include "tree.h"
+#include "xdiff-interface.h"
struct merge_options_internal {
/*
@@ -245,6 +246,9 @@ static void merge_start(struct merge_options *opt, struct merge_result *result)
assert(opt->priv == NULL);
+ /* Default to histogram diff. Actually, just hardcode it...for now. */
+ opt->xdl_opts = DIFF_WITH_ALG(opt, HISTOGRAM_DIFF);
+
/* Initialization of opt->priv, our internal merge data */
opt->priv = xcalloc(1, sizeof(*opt->priv));