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>
Felipe Gonçalves Assis committed
Feb 17, 2016 at 01:15 UTC
d2b11eca7eccc4dfc22a8fc1182d9341458dd9cb
3 files changed
+14
Documentation/merge-strategies.txt
+6
@@ -81,8 +81,14 @@ no-renormalize;;
81
Disables the `renormalize` option. This overrides the
82
`merge.renormalize` configuration variable.
83
84
+no-renames;;
85
+ Turn off rename detection.
86
+ See also linkgit:git-diff[1] `--no-renames`.
87
+
88
rename-threshold=<n>;;
89
Controls the similarity threshold used for rename detection.
90
+ Re-enables rename detection if disabled by a preceding
91
+ `no-renames`.
92
See also linkgit:git-diff[1] `-M`.
93
94
subtree[=<path>];;
merge-recursive.c
+7
@@ -482,6 +482,9 @@ static struct string_list *get_renames(struct merge_options *o,
482
struct diff_options opts;
483
484
renames = xcalloc(1, sizeof(struct string_list));
485
+ if (!o->detect_rename)
486
+ return renames;
487
+
488
diff_setup(&opts);
489
DIFF_OPT_SET(&opts, RECURSIVE);
490
DIFF_OPT_CLR(&opts, RENAME_EMPTY);
@@ -2039,6 +2042,7 @@ void init_merge_options(struct merge_options *o)
2042
o->diff_rename_limit = -1;
2043
o->merge_rename_limit = -1;
2044
o->renormalize = 0;
2045
+ o->detect_rename = 1;
2046
merge_recursive_config(o);
2047
if (getenv("GIT_MERGE_VERBOSITY"))
2048
o->verbosity =
@@ -2088,9 +2092,12 @@ int parse_merge_opt(struct merge_options *o, const char *s)
2092
o->renormalize = 1;
2093
else if (!strcmp(s, "no-renormalize"))
2094
o->renormalize = 0;
2095
+ else if (!strcmp(s, "no-renames"))
2096
+ o->detect_rename = 0;
2097
else if (skip_prefix(s, "rename-threshold=", &arg)) {
2098
if ((o->rename_score = parse_rename_score(&arg)) == -1 || *arg != 0)
2099
return -1;
2100
+ o->detect_rename = 1;
2101
}
2102
else
2103
return -1;
merge-recursive.h
+1
@@ -17,6 +17,7 @@ struct merge_options {
17
unsigned renormalize : 1;
18
long xdl_opts;
19
int verbosity;
20
+ int detect_rename;
21
int diff_rename_limit;
22
int merge_rename_limit;
23
int rename_score;