Repository navigation
Conversation
This removes a backwards goto, and prepares the code to be more readable once exact matching is added
This also fixes an issue with large number of renames in a single diff not being correctly detected as renames due to hitting opts->rename_limit. Since OID matching can be done far faster, there is no need to limit comparing in the exact matching loop. Since there now is an exact match loop, GIT_DIFF_FIND_EXACT_MATCH_ONLY now bypasses the inexact matching.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is currently split in two commits, and the TL;DR is that this vastly improves rename detection performance for 'move without change' scenarios.
The first one extracts the code related to the label
find_best_matchesingit_diff_find_similarto a separate function. This should have zero behavioural changes.The second commit add a round of cheaper exact matching before doing the existing inexact matching. The exact matching relies on comparing OIDs, and ignores
opts->rename_limitsince it's really cheap to run. Without having inspected the git CLI code, this seems to be the same behaviour. At the very least, it's able to find more renames than any numeric parameter provided in. Inexact matching still respects the limit though.However, due to these changes, moving large amounts of files around are now correctly detected as renamed files. A user of Gittyup was pointing to https://codeberg.org/ArkyonVeil/HarkiusWars.Relic.Update/src/branch/GitStresser as a problematic repo demonstrating slow operations. This contains 4k+ files that are unchanged, but moved. Before, only
opts->rename_limitnumber of renames were recognised, with the rest being add+delete pairs. With this fix, all 4k+ renames are recognised as such. On my machine running blame on any of these files has a 1000x performance improvement (~16ms instead of ~16 seconds).Relates to #3027