- Notifications
You must be signed in to change notification settings - Fork2.5k
git_diff_find_similar doesn't always remove unmodified deltas#6642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
When finding similar deltas, count the targets that are tagged to be deleted.Apply deletions even in the absense of rewrites or updates.
When excluding non-blob deltas as potential rename sources, honour the“remove unmodified” option (if the delta is unmodified).
Thanks for this,@yori - and apologies for the delay, it took me a few read-throughs to remember the diff code and how it was all working together. This looks good to me. I think that we should pull the test out of the target handling, though, and into its own function. (Since this took me so long to review, I just went ahead and made that change on top of your PR, I hope you don't mind. 🙏 ) Thanks again! |
Unmodified deltas are not always removed by git_diff_find_similar() when GIT_DIFF_FIND_REMOVE_UNMODIFIED is set. It only works correctly when a rename or copy is found in the diff. Somewhat understandably, this is the only case covered by the unit tests.
Non-blob deltas also avoid removal because of the way they are excluded as rename candidates. I've added a test for this using the "submodules" fixture. Maybe there's a simpler way to test for non-blob deltas?