我正在尝试对 Linux 系统上具有 Windows 行结尾的文件应用补丁,但由于文件中的回车符而出现冲突。
-l
选项(忽略空格)不会忽略 EOL 字符。 有没有办法获得补丁来忽略Windows风格的行结尾?
最佳答案
尝试使用联机帮助页中的 --binary 选项(重点是我的)
--binary
Write all files in binary mode, except for standard output and /dev/tty. When reading, disable the heuristic for transforming CRLF line endings into LF line endings. (On POSIX -conforming systems, reads and writes never transform line endings. On Windows, reads and writes do transform line endings by default, and patches should be generated by diff --binary when line endings are significant.)
我不完全理解上面的内容,但它对我来说在 Linux 机器上将 Unix 补丁应用到 DOS 文件上是有效的。
关于whitespace - 如何获得补丁以忽略回车符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7754972/