whitespace - 如何获得补丁以忽略回车符?

标签 whitespace patch carriage-return eol

我正在尝试对 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/

相关文章:

r - “fread”与前导/尾随空格不兼容?

html - Jade - 控制 HTML 输出中的换行符

shell - 应用补丁,排除特定文件夹

vim - 将 ^M (Windows) 换行符转换为普通换行符

python - 在 Python 中使用正则表达式定位回车符和换行符的问题

linux - 使用 bash 删除文件每一行开头的空格

batch-file - 处理文件名中的空格、FOR 循环、批处理

mercurial - 如果您在补丁队列中的单个补丁中更改太多,该怎么办?

scala - 删除 DAO 模型中的可选字段

php - 回车在 javascript-php 上下文中的意义是什么?