mirror of
https://git.proxmox.com/git/libgit2
synced 2026-01-06 18:52:21 +00:00
Don't check rename if file size difference is huge
This commit is contained in:
parent
69c66b554e
commit
18e9efc425
@ -446,6 +446,8 @@ static int similarity_calc(
|
||||
}
|
||||
|
||||
blobsize = git_blob_rawsize(blob);
|
||||
if (!file->size)
|
||||
file->size = blobsize;
|
||||
if (!git__is_sizet(blobsize)) /* ? what to do ? */
|
||||
blobsize = (size_t)-1;
|
||||
|
||||
@ -510,6 +512,13 @@ static int similarity_measure(
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check if file sizes too small or nowhere near each other */
|
||||
if (a_file->size > 127 &&
|
||||
b_file->size > 127 &&
|
||||
(a_file->size > (b_file->size << 4) ||
|
||||
b_file->size > (a_file->size << 4)))
|
||||
return 0;
|
||||
|
||||
/* update signature cache if needed */
|
||||
if (!cache[a_idx] && similarity_calc(diff, opts, a_idx, cache) < 0)
|
||||
return -1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user