Apply patch fails for certain line endings
Created originally on Bitbucket by psuter (Peter Suter)
- Create a repository.
- Commit a file with Windows line endings, and no newline at end of file as rev0.
- Commit a change to the last line (still no newline at the end of file) as rev1.
- Export a patch from rev0 to rev1.
- Update to rev0.
- Apply that patch. This only works because the patch contains mixed line endings.
- Revert to a clean rev0.
- Modify the patch to all Windows line endings.
- Apply that patch. This fails!
E.g. SVN exports such patches with all Windows line endings. E.g. GNU patch can apply those patches. TortoiseHG Apply Patch can not apply those patches.