Fix patching of files with a trailing "\r" when the diff expects no newline
Updated 10 months, 1 week ago
| Christian Hammond | Reviewers | ||
| trunk | reviewboard | ||
| 386 | |||
| None | Review Board SVN | ||
Files without a newline come out of perforce with a trailing "\r". Diff indicates "No newline at end of file" when the last line contains only a \r at the end. However, our newline normalizer converted all \r's to \n's, which meant that patch saw a newline when it expected none. We now strip that last \n if the last character was previously a \r.
Added unit tests which reproduce this problem. Haven't tested in a production environment yet but it should work. It remains to be seen if this breaks anything on Windows hosts. We can probably account for that if it does.