Skip to content

Conversation

yori
Copy link
Contributor

@yori yori commented Oct 7, 2023

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?

yori and others added 3 commits October 7, 2023 13:23
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).
@ethomson
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants