aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonin Delpeuch <antonin@delpeuch.eu>2025-11-06 22:41:53 +0000
committerJunio C Hamano <gitster@pobox.com>2025-11-07 07:32:52 -0800
commitbd7255c992b6e0423246d15936981c45e3813a99 (patch)
tree19399734fe7a05ca94e0c5d71803c56ba52472a0
parentSync with Git 2.51.2 (diff)
downloadgit-bd7255c992b6e0423246d15936981c45e3813a99.tar.gz
git-bd7255c992b6e0423246d15936981c45e3813a99.zip
xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASK
The XDF_DIFF_ALGORITHM_MASK bit mask only includes bits for the patience and histogram diffs, not for the minimal one. This means that when reseting the diff algorithm to the default one, one needs to separately clear the bit for the minimal diff. There are places in the code that fail to do that: merge-ort.c and builtin/merge-file.c. Add the XDF_NEED_MINIMAL bit to the bit mask, and remove the separate clearing of this bit in the places where it hasn't been forgotten. Signed-off-by: Antonin Delpeuch <antonin@delpeuch.eu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--diff.c2
-rw-r--r--merge-ort.c2
-rw-r--r--xdiff/xdiff.h2
3 files changed, 1 insertions, 5 deletions
diff --git a/diff.c b/diff.c
index a74e701806..f0a0cecc76 100644
--- a/diff.c
+++ b/diff.c
@@ -3526,8 +3526,6 @@ static int set_diff_algorithm(struct diff_options *opts,
if (value < 0)
return -1;
- /* clear out previous settings */
- DIFF_XDL_CLR(opts, NEED_MINIMAL);
opts->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
opts->xdl_opts |= value;
diff --git a/merge-ort.c b/merge-ort.c
index 29858074f9..9b2b0fce7e 100644
--- a/merge-ort.c
+++ b/merge-ort.c
@@ -5495,8 +5495,6 @@ int parse_merge_opt(struct merge_options *opt, const char *s)
long value = parse_algorithm_value(arg);
if (value < 0)
return -1;
- /* clear out previous settings */
- DIFF_XDL_CLR(opt, NEED_MINIMAL);
opt->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
opt->xdl_opts |= value;
}
diff --git a/xdiff/xdiff.h b/xdiff/xdiff.h
index 2cecde5afe..dc370712e9 100644
--- a/xdiff/xdiff.h
+++ b/xdiff/xdiff.h
@@ -43,7 +43,7 @@ extern "C" {
#define XDF_PATIENCE_DIFF (1 << 14)
#define XDF_HISTOGRAM_DIFF (1 << 15)
-#define XDF_DIFF_ALGORITHM_MASK (XDF_PATIENCE_DIFF | XDF_HISTOGRAM_DIFF)
+#define XDF_DIFF_ALGORITHM_MASK (XDF_PATIENCE_DIFF | XDF_HISTOGRAM_DIFF | XDF_NEED_MINIMAL)
#define XDF_DIFF_ALG(x) ((x) & XDF_DIFF_ALGORITHM_MASK)
#define XDF_INDENT_HEURISTIC (1 << 23)