Commit 18e9efc4 by Russell Belfer

Don't check rename if file size difference is huge

parent 69c66b55
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment