Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--diffcore-rename.c2
-rwxr-xr-xt/t4001-diff-rename.sh15
2 files changed, 17 insertions, 0 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 9ca0eaec70..245e999fe5 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))
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index 0d1fa45d25..eadf4f6244 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -230,4 +230,19 @@ test_expect_success 'rename pretty print common prefix and suffix overlap' '
test_i18ngrep " d/f/{ => f}/e " output
'
+test_expect_success 'diff-tree -l0 defaults to a big rename limit, not zero' '
+ test_write_lines line1 line2 line3 >myfile &&
+ git add myfile &&
+ git commit -m x &&
+
+ test_write_lines line1 line2 line4 >myotherfile &&
+ git rm myfile &&
+ git add myotherfile &&
+ git commit -m x &&
+
+ git diff-tree -M -l0 HEAD HEAD^ >actual &&
+ # Verify that a rename from myotherfile to myfile was detected
+ grep "myotherfile.*myfile" actual
+'
+
test_done