Skip to content

Commit bd7255c

Browse files
wetnebgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 419c72c commit bd7255c

File tree

3 files changed

+1
-5
lines changed

3 files changed

+1
-5
lines changed

diff.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3526,8 +3526,6 @@ static int set_diff_algorithm(struct diff_options *opts,
35263526
if (value < 0)
35273527
return -1;
35283528

3529-
/* clear out previous settings */
3530-
DIFF_XDL_CLR(opts, NEED_MINIMAL);
35313529
opts->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
35323530
opts->xdl_opts |= value;
35333531

merge-ort.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5495,8 +5495,6 @@ int parse_merge_opt(struct merge_options *opt, const char *s)
54955495
long value = parse_algorithm_value(arg);
54965496
if (value < 0)
54975497
return -1;
5498-
/* clear out previous settings */
5499-
DIFF_XDL_CLR(opt, NEED_MINIMAL);
55005498
opt->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
55015499
opt->xdl_opts |= value;
55025500
}

xdiff/xdiff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern "C" {
4343

4444
#define XDF_PATIENCE_DIFF (1 << 14)
4545
#define XDF_HISTOGRAM_DIFF (1 << 15)
46-
#define XDF_DIFF_ALGORITHM_MASK (XDF_PATIENCE_DIFF | XDF_HISTOGRAM_DIFF)
46+
#define XDF_DIFF_ALGORITHM_MASK (XDF_PATIENCE_DIFF | XDF_HISTOGRAM_DIFF | XDF_NEED_MINIMAL)
4747
#define XDF_DIFF_ALG(x) ((x) & XDF_DIFF_ALGORITHM_MASK)
4848

4949
#define XDF_INDENT_HEURISTIC (1 << 23)

0 commit comments

Comments
 (0)