You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The libgit2 api allows you to set, among others, the rename_threshold when calling git_diff_find_similar but this doesn't seem to be supported in pygit2.
Would be great if this could be implemented!
I tried to change it myself but I can't seem to do this without getting a "ValueError: Invalid version 0 on git_diff_find_options" error when trying to call it... Probably just my lack of C++ skills. Diff of my changes is below.
Ok, I've been debugging for a while now and I can't really seem to figure this out.
I checked out libgit2 and added a printf statement in the function that actually does the diffing (in file src/diff_tform.c, function git_diff_find_similar). The parameters printed here match the parameters I pass into pygit2. So my changes from the pull request definitely work.
However, it seems that the rewrite_threshold (and possible other parameters, haven't tested yet) is completely ignored by libgit2: only files that match exactly are considered moves, and rewrite-moves are considered a delete and a create. For reference, command-line git does detect these rewrite-moves as moves when using a parameter such as -M50%
Does anyone have an idea on what to check next?
Edit: Figured it out. The behaviour was correct all along, I was just testing it with files that were too small to compute a similarity score on.
The libgit2 api allows you to set, among others, the
rename_threshold
when callinggit_diff_find_similar
but this doesn't seem to be supported in pygit2.Would be great if this could be implemented!
I tried to change it myself but I can't seem to do this without getting a "ValueError: Invalid version 0 on git_diff_find_options" error when trying to call it... Probably just my lack of C++ skills. Diff of my changes is below.
The text was updated successfully, but these errors were encountered: