Skip to content

Commit

Permalink
Merge branch 'jk/diff-algo-finishing-touches'
Browse files Browse the repository at this point in the history
"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
  • Loading branch information
Junio C Hamano committed Apr 15, 2013
2 parents 948cf4f + 0895c6d commit 825ccfc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Documentation/merge-strategies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ patience;;
this when the branches to be merged have diverged wildly.
See also linkgit:git-diff[1] `--patience`.

diff-algorithm=[patience|minimal|histogram|myers];;
Tells 'merge-recursive' to use a different diff algorithm, which
can help avoid mismerges that occur due to unimportant matching
lines (such as braces from distinct functions). See also
linkgit:git-diff[1] `--diff-algorithm`.

ignore-space-change;;
ignore-all-space;;
ignore-space-at-eol;;
Expand Down
5 changes: 3 additions & 2 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -3596,15 +3596,16 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
options->xdl_opts = DIFF_WITH_ALG(options, PATIENCE_DIFF);
else if (!strcmp(arg, "--histogram"))
options->xdl_opts = DIFF_WITH_ALG(options, HISTOGRAM_DIFF);
else if (!prefixcmp(arg, "--diff-algorithm=")) {
long value = parse_algorithm_value(arg+17);
else if ((argcount = parse_long_opt("diff-algorithm", av, &optarg))) {
long value = parse_algorithm_value(optarg);
if (value < 0)
return error("option diff-algorithm accepts \"myers\", "
"\"minimal\", \"patience\" and \"histogram\"");
/* clear out previous settings */
DIFF_XDL_CLR(options, NEED_MINIMAL);
options->xdl_opts &= ~XDF_DIFF_ALGORITHM_MASK;
options->xdl_opts |= value;
return argcount;
}

/* flags options */
Expand Down

0 comments on commit 825ccfc

Please sign in to comment.