From 89973554b52cb533b01acfdcb16d8215344bf004 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Wed, 29 Nov 2017 12:11:54 -0800 Subject: diffcore-rename: make diff-tree -l0 mean -l In the documentation of diff-tree, it is stated that the -l option "prevents rename/copy detection from running if the number of rename/copy targets exceeds the specified number". The documentation does not mention any special handling for the number 0, but the implementation before commit 9f7e4bfa3b ("diff: remove silent clamp of renameLimit", 2017-11-13) treated 0 as a special value indicating that the rename limit is to be a very large number instead. The commit 9f7e4bfa3b changed that behavior, treating 0 as 0. Revert this behavior to what it was previously. This allows existing scripts and tools that use "-l0" to continue working. The alternative (to have "-l0" suppress rename detection) is probably much less useful, since users can just refrain from specifying -M and/or -C to have the same effect. Signed-off-by: Jonathan Tan Reviewed-by: Jonathan Nieder Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- diffcore-rename.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'diffcore-rename.c') diff --git a/diffcore-rename.c b/diffcore-rename.c index 9ca0eaec7..245e999fe 100644 --- a/diffcore-rename.c +++ b/diffcore-rename.c @@ -392,6 +392,8 @@ static int too_many_rename_candidates(int num_create, * * num_create * num_src > rename_limit * rename_limit */ + if (rename_limit <= 0) + rename_limit = 32767; if ((num_create <= rename_limit || num_src <= rename_limit) && ((uint64_t)num_create * (uint64_t)num_src <= (uint64_t)rename_limit * (uint64_t)rename_limit)) -- cgit v1.2.1