Git fork

merge-ort: enable diff-algorithms other than histogram

The ort merge strategy has always used the histogram diff algorithm.
The recursive merge strategy, in contrast, defaults to the myers
diff algorithm, while allowing it to be changed.

Change the ort merge strategy to allow different diff algorithms, by
removing the hard coded value in merge_start() and instead just making
it a default in init_merge_options(). Technically, this also changes
the default diff algorithm for the recursive backend too, but we're
going to remove the final callers of the recursive backend in the next
two commits.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Elijah Newren and committed by
Junio C Hamano
2e806d84 77c02949

+16 -17
+15 -14
Documentation/merge-strategies.adoc
··· 87 87 configuration variable. 88 88 See also linkgit:git-diff[1] `--no-renames`. 89 89 90 + histogram;; 91 + Deprecated synonym for `diff-algorithm=histogram`. 92 + 93 + patience;; 94 + Deprecated synonym for `diff-algorithm=patience`. 95 + 96 + diff-algorithm=[histogram|minimal|myers|patience];; 97 + Use a different diff algorithm while merging, which can help 98 + avoid mismerges that occur due to unimportant matching lines 99 + (such as braces from distinct functions). See also 100 + linkgit:git-diff[1] `--diff-algorithm`. Note that `ort` 101 + defaults to `diff-algorithm=histogram`, while regular diffs 102 + currently default to the `diff.algorithm` config setting. 103 + 90 104 subtree[=<path>];; 91 105 This option is a more advanced form of 'subtree' strategy, where 92 106 the strategy makes a guess on how two trees must be shifted to ··· 111 125 For a path that is a submodule, the same caution as 'ort' applies to this 112 126 strategy. 113 127 + 114 - The 'recursive' strategy takes the same options as 'ort'. However, 115 - there are two additional options that 'ort' ignores (not documented 116 - above) that are potentially useful with the 'recursive' strategy: 117 - 118 - patience;; 119 - Deprecated synonym for `diff-algorithm=patience`. 120 - 121 - diff-algorithm=[patience|minimal|histogram|myers];; 122 - Use a different diff algorithm while merging, which can help 123 - avoid mismerges that occur due to unimportant matching lines 124 - (such as braces from distinct functions). See also 125 - linkgit:git-diff[1] `--diff-algorithm`. Note that `ort` 126 - specifically uses `diff-algorithm=histogram`, while `recursive` 127 - defaults to the `diff.algorithm` config setting. 128 + The 'recursive' strategy takes the same options as 'ort'. 128 129 129 130 resolve:: 130 131 This can only resolve two heads (i.e. the current branch
-3
merge-ort.c
··· 4957 4957 } 4958 4958 trace2_region_leave("merge", "sanity checks", opt->repo); 4959 4959 4960 - /* Default to histogram diff. Actually, just hardcode it...for now. */ 4961 - opt->xdl_opts = DIFF_WITH_ALG(opt, HISTOGRAM_DIFF); 4962 - 4963 4960 /* Handle attr direction stuff for renormalization */ 4964 4961 if (opt->renormalize) 4965 4962 git_attr_set_direction(GIT_ATTR_CHECKOUT);
+1
merge-recursive.c
··· 3981 3981 opt->renormalize = 0; 3982 3982 3983 3983 opt->conflict_style = -1; 3984 + opt->xdl_opts = DIFF_WITH_ALG(opt, HISTOGRAM_DIFF); 3984 3985 3985 3986 merge_recursive_config(opt, ui); 3986 3987 merge_verbosity = getenv("GIT_MERGE_VERBOSITY");