Hi, I would like to set up a Git repository with a custom merge driver, and then disable rename detection when merging. Unfortunately, the recursive strategy has no "no-renames" option. Note that I would like to avoid rename detection even when the file contents perfectly match. The usual workaround is using the resolve strategy, but apparently it ignores the custom merge driver. Besides, I would really like to use the recursive strategy logic. Is there any solution to this in the current version? If not, what do you think about adding a "no-renames" option to the recursive strategy? I could work on a patch. Attached is a quick and dirty patch that emulates the effect by allowing greater than 100% rename thresholds to mean "no-renames". And here is a related question on StackOverflow: http://stackoverflow.com/questions/35135517/custom-git-merge-driver-with-no-rename-detection Thanks in advance for any attention provided. Regards, Felipe Gonçalves Assis
From bcef6c44fac3a29afe03408ef27024776da861ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Gon=C3=A7alves=20Assis?= <felipegassis@xxxxxxxxx> Date: Sun, 14 Feb 2016 17:02:00 -0200 Subject: [PATCH] diff: rename threshold above 100% means no renames --- diff.c | 2 +- diffcore-rename.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/diff.c b/diff.c index 2136b69..43b9e0a 100644 --- a/diff.c +++ b/diff.c @@ -4003,7 +4003,7 @@ int parse_rename_score(const char **cp_p) /* user says num divided by scale and we say internally that * is MAX_SCORE * num / scale. */ - return (int)((num >= scale) ? MAX_SCORE : (MAX_SCORE * num / scale)); + return (int)(MAX_SCORE * num / scale); } static int diff_scoreopt_parse(const char *opt) diff --git a/diffcore-rename.c b/diffcore-rename.c index af1fe08..7cb5a3b 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -497,7 +497,7 @@ void diffcore_rename(struct diff_options *options) register_rename_src(p); } } - if (rename_dst_nr == 0 || rename_src_nr == 0) + if (rename_dst_nr == 0 || rename_src_nr == 0 || minimum_score > MAX_SCORE) goto cleanup; /* nothing to do */ /* -- 2.7.1.287.g4943984