summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-09-09 20:34:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-09 21:13:53 (GMT)
commit5a29cbc6e9c5f7d28228f4f389a122ca074a9c08 (patch)
treed49573deea0f9582988d049f30de875b43ce619a
parent6ebdac1bab966b720d776aa43ca188fe378b1f4b (diff)
downloadgit-5a29cbc6e9c5f7d28228f4f389a122ca074a9c08.zip
git-5a29cbc6e9c5f7d28228f4f389a122ca074a9c08.tar.gz
git-5a29cbc6e9c5f7d28228f4f389a122ca074a9c08.tar.bz2
patch-ids: turn off rename detection
The patch-id code may be running inside another porcelain like "git log" or "git format-patch", and therefore may have set diff_detect_rename_default, either via the diff-ui config, or by default since 5404c11 (diff: activate diff.renames by default, 2016-02-25). This is the case even if a command is run with `--no-renames`, as that is applied only to the diff-options used by the command itself. Rename detection doesn't help the patch-id results. It _may_ actually hurt, as minor differences in the files that would be overlooked by patch-id's canonicalization might result in different renames (though I'd doubt that it ever comes up in practice). But mostly it is just a waste of CPU to compute these renames. Note that this does have one user-visible impact: the prerequisite patches listed by "format-patch --base". There may be some confusion between different versions of git as older ones will enable renames, but newer ones will not. However, this was already a problem, as people with different settings for the "diff.renames" config would get different results. After this patch, everyone should get the same results, regardless of their config. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--patch-ids.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/patch-ids.c b/patch-ids.c
index 082412a..77e4663 100644
--- a/patch-ids.c
+++ b/patch-ids.c
@@ -45,6 +45,7 @@ int init_patch_ids(struct patch_ids *ids)
{
memset(ids, 0, sizeof(*ids));
diff_setup(&ids->diffopts);
+ ids->diffopts.detect_rename = 0;
DIFF_OPT_SET(&ids->diffopts, RECURSIVE);
diff_setup_done(&ids->diffopts);
hashmap_init(&ids->patches, (hashmap_cmp_fn)patch_id_cmp, 256);