Repository navigation
Conversation
The parser removed every "\ No newline at end of file" string from the whole input before splitting it into lines. When the diff is for a patch file, content lines like " \ No newline at end of file" lost that text and showed up as " ", "-" or "+". Now only lines that start with "\ " are skipped. This matches how git apply finds the marker, and it also skips translated markers from GNU diff. Fixes rtfpessoa#598
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.
Fixes #598
The parser removed every "\ No newline at end of file" string from the whole input before it split the input into lines. So when the diff is for a patch file, content lines like
\ No newline at end of filelost that text and showed up as,-or+.Now the parser only skips lines that start with
\, in the same check that already skips empty lines. This is howgit applyfinds the marker, and it also covers translated markers from GNU diff.Output for normal diffs does not change. I checked
parse()output against master for every diff in the tests and for realgit diff/diff -uoutput, with LF, CRLF and CR line endings, and withdiffMaxChangesanddiffMaxLineLengthset.Added a test for a diff of a patch file.
npm test,npm run lint:checkandtsc --noEmitpass.Note: #556 (for #157) also removes the global replace, to show the marker in the output. This PR only stops content lines from being changed, so the two should be easy to combine.