Skip to content

Commit 5a29cbc

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6ebdac1 commit 5a29cbc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

patch-ids.c

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ int init_patch_ids(struct patch_ids *ids)
4545
{
4646
memset(ids, 0, sizeof(*ids));
4747
diff_setup(&ids->diffopts);
48+
ids->diffopts.detect_rename = 0;
4849
DIFF_OPT_SET(&ids->diffopts, RECURSIVE);
4950
diff_setup_done(&ids->diffopts);
5051
hashmap_init(&ids->patches, (hashmap_cmp_fn)patch_id_cmp, 256);

0 commit comments

Comments
 (0)