csc*_*mge 14
我几次遇到这个问题.这是我发现的:
所以这就是我做的:
如果要维护该约定,可以使用unix2dos将修补文件转换回CRLF行结尾.
小智 14
使用--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. This option is needed
on POSIX systems when applying patches generated on non-POSIX systems to non-POSIX files. (On
POSIX systems, file 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.)
Run Code Online (Sandbox Code Playgroud)
小智 8
联合:
dos2unix patchfile.diff
dos2unix $(grep 'Index:' patchfile.diff | awk '{print $2}')
patch --verbose -p0 -i patchfile.diff
unix2dos $(grep 'Index:' patchfile.diff | awk '{print $2}')
Run Code Online (Sandbox Code Playgroud)
最后一行取决于您是否要保留CRLF.
M.
PS.这应该是对cscrimge帖子的回复.DS.
| 归档时间: |
|
| 查看次数: |
12664 次 |
| 最近记录: |