From: "Felipe Gonçalves Assis" <felipeg.assis@gmail.com>
To: git@vger.kernel.org
Cc: Johannes.Schindelin@gmx.de, gitster@pobox.com,
"Felipe Gonçalves Assis" <felipegassis@gmail.com>
Subject: [PATCH] merge-recursive: option to disable renames
Date: Mon, 15 Feb 2016 22:50:34 -0200 [thread overview]
Message-ID: <1455583834-4796-1-git-send-email-felipegassis@gmail.com> (raw)
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>
---
Hi, this is a patch relative to the "Custom merge driver with no rename
detection" thread, based on suggestions by Junio C Hamano.
Documentation/merge-strategies.txt | 4 ++++
merge-recursive.c | 16 +++++++++++++---
merge-recursive.h | 1 +
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt
index 7bbd19b..0528d85 100644
--- a/Documentation/merge-strategies.txt
+++ b/Documentation/merge-strategies.txt
@@ -81,6 +81,10 @@ no-renormalize;;
Disables the `renormalize` option. This overrides the
`merge.renormalize` configuration variable.
+no-renames;;
+ Turn off rename detection.
+ See also linkgit:git-diff[1] `--no-renames`.
+
rename-threshold=<n>;;
Controls the similarity threshold used for rename detection.
See also linkgit:git-diff[1] `-M`.
diff --git a/merge-recursive.c b/merge-recursive.c
index 8eabde2..ca67805 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1839,9 +1839,16 @@ int merge_trees(struct merge_options *o,
entries = get_unmerged();
record_df_conflict_files(o, entries);
- re_head = get_renames(o, head, common, head, merge, entries);
- re_merge = get_renames(o, merge, common, head, merge, entries);
- clean = process_renames(o, re_head, re_merge);
+ if (o->detect_rename) {
+ re_head = get_renames(o, head, common, head, merge, entries);
+ re_merge = get_renames(o, merge, common, head, merge, entries);
+ clean = process_renames(o, re_head, re_merge);
+ }
+ else {
+ re_head = xcalloc(1, sizeof(struct string_list));
+ re_merge = xcalloc(1, sizeof(struct string_list));
+ clean = 1;
+ }
for (i = entries->nr-1; 0 <= i; i--) {
const char *path = entries->items[i].string;
struct stage_data *e = entries->items[i].util;
@@ -2039,6 +2046,7 @@ void init_merge_options(struct merge_options *o)
o->diff_rename_limit = -1;
o->merge_rename_limit = -1;
o->renormalize = 0;
+ o->detect_rename = DIFF_DETECT_RENAME;
merge_recursive_config(o);
if (getenv("GIT_MERGE_VERBOSITY"))
o->verbosity =
@@ -2088,6 +2096,8 @@ int parse_merge_opt(struct merge_options *o, const char *s)
o->renormalize = 1;
else if (!strcmp(s, "no-renormalize"))
o->renormalize = 0;
+ else if (!strcmp(s, "no-renames"))
+ o->detect_rename = 0;
else if (skip_prefix(s, "rename-threshold=", &arg)) {
if ((o->rename_score = parse_rename_score(&arg)) == -1 || *arg != 0)
return -1;
diff --git a/merge-recursive.h b/merge-recursive.h
index 9e090a3..52f0201 100644
--- a/merge-recursive.h
+++ b/merge-recursive.h
@@ -17,6 +17,7 @@ struct merge_options {
unsigned renormalize : 1;
long xdl_opts;
int verbosity;
+ int detect_rename;
int diff_rename_limit;
int merge_rename_limit;
int rename_score;
--
2.7.1.291.gd6478c6
next reply other threads:[~2016-02-16 0:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 0:50 Felipe Gonçalves Assis [this message]
2016-02-16 21:49 ` [PATCH] merge-recursive: option to disable renames Junio C Hamano
2016-02-16 22:10 ` Junio C Hamano
2016-02-16 22:42 ` Felipe Gonçalves Assis
2016-02-16 23:43 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455583834-4796-1-git-send-email-felipegassis@gmail.com \
--to=felipeg.assis@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=felipegassis@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).