Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error with redundant line breaks
This fixes an error with a repository, where an added file has \r\r\n as line breaks. This interesting combination is handled as a single line break by the diff operation, while Java's Scanner implementation handles this as two lines (the first one delimited by the first \r, the second one delimited by \r\n. This led to empty lines inside the diff, where we only expect lines that contain at least one character (' ', '+' or '-'), and this in turn led to an index out of bounds exception. Now we handle each combination of any kind of new line delimiter characters as a single delimiter. This should be safe, because, as mentioned earlier, we always expect at least one character in a line for a diff output.
- Loading branch information
Showing
2 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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