Add the ability to control rename detection for merge via a config setting. Reviewed-by: Johannes Schindelin <johannes.schindelin@xxxxxx> Signed-off-by: Ben Peart <benpeart@xxxxxxxxxxxxx> --- Documentation/diff-config.txt | 3 ++- Documentation/merge-config.txt | 8 +++++++- Documentation/merge-strategies.txt | 6 ++++-- builtin/merge.c | 1 + merge-recursive.c | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Documentation/diff-config.txt b/Documentation/diff-config.txt index 5ca942ab5e..77caa66c2f 100644 --- a/Documentation/diff-config.txt +++ b/Documentation/diff-config.txt @@ -112,7 +112,8 @@ diff.orderFile:: diff.renameLimit:: The number of files to consider when performing the copy/rename - detection; equivalent to the 'git diff' option `-l`. + detection; equivalent to the 'git diff' option `-l`. This setting + has no effect if rename detection is turned off. diff.renames:: Whether and how Git detects renames. If set to "false", diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt index 12b6bbf591..0540c44e23 100644 --- a/Documentation/merge-config.txt +++ b/Documentation/merge-config.txt @@ -35,7 +35,13 @@ include::fmt-merge-msg-config.txt[] merge.renameLimit:: The number of files to consider when performing rename detection during a merge; if not specified, defaults to the value of - diff.renameLimit. + diff.renameLimit. This setting has no effect if rename detection + is turned off. + +merge.renames:: + Whether and how Git detects renames. If set to "false", + rename detection is disabled. If set to "true", basic rename + detection is enabled. This is the default. merge.renormalize:: Tell Git that canonical representation of files in the diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt index 4a58aad4b8..1e0728aa12 100644 --- a/Documentation/merge-strategies.txt +++ b/Documentation/merge-strategies.txt @@ -84,12 +84,14 @@ no-renormalize;; `merge.renormalize` configuration variable. no-renames;; - Turn off rename detection. + Turn off rename detection. This overrides the `merge.renames` + configuration variable. See also linkgit:git-diff[1] `--no-renames`. find-renames[=<n>];; Turn on rename detection, optionally setting the similarity - threshold. This is the default. + threshold. This is the default. This overrides the + 'merge.renames' configuration variable. See also linkgit:git-diff[1] `--find-renames`. rename-threshold=<n>;; diff --git a/builtin/merge.c b/builtin/merge.c index 8746c5e3e8..3be52cd316 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -424,6 +424,7 @@ static void finish(struct commit *head_commit, opts.output_format |= DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT; opts.detect_rename = DIFF_DETECT_RENAME; + git_config_get_bool("merge.renames", &opts.detect_rename); diff_setup_done(&opts); diff_tree_oid(head, new_head, "", &opts); diffcore_std(&opts); diff --git a/merge-recursive.c b/merge-recursive.c index 9c05eb7f70..cd5367e890 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3256,6 +3256,7 @@ static void merge_recursive_config(struct merge_options *o) git_config_get_int("merge.verbosity", &o->verbosity); git_config_get_int("diff.renamelimit", &o->diff_rename_limit); git_config_get_int("merge.renamelimit", &o->merge_rename_limit); + git_config_get_bool("merge.renames", &o->detect_rename); git_config(git_xmerge_config, NULL); } -- 2.17.0.windows.1