merge-recursive: option to disable renames
The recursive strategy turns on rename detection by default. Add a strategy option to disable rename detection even for exact renames. Signed-off-by: Felipe Gonçalves Assis <felipegassis@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
754884255b
commit
d2b11eca7e
|
@ -81,8 +81,14 @@ no-renormalize;;
|
||||||
Disables the `renormalize` option. This overrides the
|
Disables the `renormalize` option. This overrides the
|
||||||
`merge.renormalize` configuration variable.
|
`merge.renormalize` configuration variable.
|
||||||
|
|
||||||
|
no-renames;;
|
||||||
|
Turn off rename detection.
|
||||||
|
See also linkgit:git-diff[1] `--no-renames`.
|
||||||
|
|
||||||
rename-threshold=<n>;;
|
rename-threshold=<n>;;
|
||||||
Controls the similarity threshold used for rename detection.
|
Controls the similarity threshold used for rename detection.
|
||||||
|
Re-enables rename detection if disabled by a preceding
|
||||||
|
`no-renames`.
|
||||||
See also linkgit:git-diff[1] `-M`.
|
See also linkgit:git-diff[1] `-M`.
|
||||||
|
|
||||||
subtree[=<path>];;
|
subtree[=<path>];;
|
||||||
|
|
|
@ -482,6 +482,9 @@ static struct string_list *get_renames(struct merge_options *o,
|
||||||
struct diff_options opts;
|
struct diff_options opts;
|
||||||
|
|
||||||
renames = xcalloc(1, sizeof(struct string_list));
|
renames = xcalloc(1, sizeof(struct string_list));
|
||||||
|
if (!o->detect_rename)
|
||||||
|
return renames;
|
||||||
|
|
||||||
diff_setup(&opts);
|
diff_setup(&opts);
|
||||||
DIFF_OPT_SET(&opts, RECURSIVE);
|
DIFF_OPT_SET(&opts, RECURSIVE);
|
||||||
DIFF_OPT_CLR(&opts, RENAME_EMPTY);
|
DIFF_OPT_CLR(&opts, RENAME_EMPTY);
|
||||||
|
@ -2039,6 +2042,7 @@ void init_merge_options(struct merge_options *o)
|
||||||
o->diff_rename_limit = -1;
|
o->diff_rename_limit = -1;
|
||||||
o->merge_rename_limit = -1;
|
o->merge_rename_limit = -1;
|
||||||
o->renormalize = 0;
|
o->renormalize = 0;
|
||||||
|
o->detect_rename = 1;
|
||||||
merge_recursive_config(o);
|
merge_recursive_config(o);
|
||||||
if (getenv("GIT_MERGE_VERBOSITY"))
|
if (getenv("GIT_MERGE_VERBOSITY"))
|
||||||
o->verbosity =
|
o->verbosity =
|
||||||
|
@ -2088,9 +2092,12 @@ int parse_merge_opt(struct merge_options *o, const char *s)
|
||||||
o->renormalize = 1;
|
o->renormalize = 1;
|
||||||
else if (!strcmp(s, "no-renormalize"))
|
else if (!strcmp(s, "no-renormalize"))
|
||||||
o->renormalize = 0;
|
o->renormalize = 0;
|
||||||
|
else if (!strcmp(s, "no-renames"))
|
||||||
|
o->detect_rename = 0;
|
||||||
else if (skip_prefix(s, "rename-threshold=", &arg)) {
|
else if (skip_prefix(s, "rename-threshold=", &arg)) {
|
||||||
if ((o->rename_score = parse_rename_score(&arg)) == -1 || *arg != 0)
|
if ((o->rename_score = parse_rename_score(&arg)) == -1 || *arg != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
o->detect_rename = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -17,6 +17,7 @@ struct merge_options {
|
||||||
unsigned renormalize : 1;
|
unsigned renormalize : 1;
|
||||||
long xdl_opts;
|
long xdl_opts;
|
||||||
int verbosity;
|
int verbosity;
|
||||||
|
int detect_rename;
|
||||||
int diff_rename_limit;
|
int diff_rename_limit;
|
||||||
int merge_rename_limit;
|
int merge_rename_limit;
|
||||||
int rename_score;
|
int rename_score;
|
||||||
|
|
Loading…
Reference in New Issue