Use git diff instead of the system diff command #5894
Closed
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.
opam already harbour a patch parser used to preprocess CRLF in patch files. As (yet another) alternative to #5892 and #5893 we can take advantage of this preprocessing and output the files that we detect are going to be deleted.
This can only happen if the format in the given patch file is parseable, this is too tricky to do with the system diff commands (see hannesm/patch#8) without a robust date parser so instead we can use
git diff --no-index
when we control the input patch (during opam update). When that's the case, we delete the empty straggler files after the application of the patch that we were able to detect.This makes the system patch command on macOS usable when packages have been deleted from an opam repository.
See #5891
Fixes #3639