Proof of concept fix for git diff parsing failure on warn [Issue #574] #585
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.
Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.
Description
SSH warnings and other unexpected output from
git diff
can create cryptic errors, as the diff parser assumes that the first line of a diff will always provide a file name for consideration. To mitigate this, ignore lines with unexpected formatting until the first line with a file header is reached.Given that the problem code is deep in the internals of diff.rb, I have taken a somewhat aggressive white-box testing approach to my accompanying unit test, which I acknowledge may prove brittle if the internals of the class change. I am open to alternative strategies as per the maintainers' recommendations.
Prospective fix for Issue #574