]> git.ipfire.org Git - thirdparty/git.git/commitdiff
xdiff: add 'minimal' to XDF_DIFF_ALGORITHM_MASK
authorAntonin Delpeuch <antonin@delpeuch.eu>
Mon, 17 Nov 2025 08:04:31 +0000 (08:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Nov 2025 17:31:59 +0000 (09:31 -0800)
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>
diff.c
merge-ort.c
xdiff/xdiff.h

diff --git a/diff.c b/diff.c
index a74e701806be52d0f447c178e6c2c40dff36560c..0eec4a2fe8ceee6648ad48107a95079232bb84c1 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -3527,7 +3527,6 @@ static int set_diff_algorithm(struct diff_options *opts,
                return -1;
 
        /* clear out previous settings */
-       DIFF_XDL_CLR(opts, NEED_MINIMAL);
        opts->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
        opts->xdl_opts |= value;
 
index 29858074f9d8bf8b8138b10f983957cd4cded16d..23e2b64c79bf2743022dc73a445c7a2683f529fd 100644 (file)
@@ -5496,7 +5496,6 @@ int parse_merge_opt(struct merge_options *opt, const char *s)
                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;
        }
index 2cecde5afe5da1623a5ddb0e6affb7cea259b5c7..dc370712e9286098d4fbf487d183cc276e5a4462 100644 (file)
@@ -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)