Fix patching of files with a trailing "\r" when the diff expects no newline
Review Request #286 — Created March 2, 2008 and submitted
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.