Skip to content

Commit 825ccfc

Browse files
committed
Merge branch 'jk/diff-algo-finishing-touches'
"git diff --diff-algorithm algo" is also understood as "git diff --diff-algorithm=algo". * jk/diff-algo-finishing-touches: diff: allow unstuck arguments with --diff-algorithm git-merge(1): document diff-algorithm option to merge-recursive
2 parents 948cf4f + 0895c6d commit 825ccfc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Documentation/merge-strategies.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ patience;;
4848
this when the branches to be merged have diverged wildly.
4949
See also linkgit:git-diff[1] `--patience`.
5050

51+
diff-algorithm=[patience|minimal|histogram|myers];;
52+
Tells 'merge-recursive' to use a different diff algorithm, which
53+
can help avoid mismerges that occur due to unimportant matching
54+
lines (such as braces from distinct functions). See also
55+
linkgit:git-diff[1] `--diff-algorithm`.
56+
5157
ignore-space-change;;
5258
ignore-all-space;;
5359
ignore-space-at-eol;;

diff.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3596,15 +3596,16 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
35963596
options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
35973597
else if (!strcmp(arg, "--histogram"))
35983598
options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
3599-
else if (!prefixcmp(arg, "--diff-algorithm=")) {
3600-
long value = parse_algorithm_value(arg+17);
3599+
else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
3600+
long value = parse_algorithm_value(optarg);
36013601
if (value < 0)
36023602
return error("option diff-algorithm accepts \"myers\", "
36033603
"\"minimal\", \"patience\" and \"histogram\"");
36043604
/* clear out previous settings */
36053605
DIFF_XDL_CLR(options, NEED_MINIMAL);
36063606
options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
36073607
options->xdl_opts |= value;
3608+
return argcount;
36083609
}
36093610

36103611
/* flags options */

0 commit comments

Comments
 (0)