Implemented parameters for Diff.find_similar()#396
Conversation
Diff.find_similar now supports the parameters that are exposed by libgit2's git_diff_find_similar. Parameters supported are rename_threshold, copy_threshold, rename_from_rewrite_threshold, break_rewrite_threshold and rename_limit
|
This pull request relates to issue #394, but it doesn't seem to solve it (similarity parameters appear to be ignored) |
src/diff.c
Outdated
There was a problem hiding this comment.
All of these values will be unitialised if they're not passed. Instead of this, you should let PyArg_ParseTupleAndKeywords write into the options structure directly.
There was a problem hiding this comment.
Thanks!
I actually figured that out myself but forgot to commit and push it... Thanks for the heads-up!
|
Okay, so it turns out that it does work. I previously tested it with a repo with very small files, and apparently libgit2 refuses to compute similarity on small files. However, when 100% similarity is required it uses a different algorithm (just comparing hashes) which does not check file size. Tested it with larger files now and it works for me. |
Diff.find_similar now supports the parameters that are exposed by libgit2's git_diff_find_similar.
Parameters supported are rename_threshold, copy_threshold,
rename_from_rewrite_threshold, break_rewrite_threshold and rename_limit