Linux システムで Windows の行末を持つファイルにパッチを適用しようとしていますが、ファイル内のキャリッジ リターンが原因で競合が発生しています。
オプション(-l
空白を無視) は EOL 文字を無視していません。Windowsスタイルの行末を無視するパッチを取得する方法はありますか?
Linux システムで Windows の行末を持つファイルにパッチを適用しようとしていますが、ファイル内のキャリッジ リターンが原因で競合が発生しています。
オプション(-l
空白を無視) は EOL 文字を無視していません。Windowsスタイルの行末を無視するパッチを取得する方法はありますか?
Try using the --binary option, from the manpage (emphasis mine)
--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.)
I don't fully understand the above, but it worked for me on a Linux machine to apply a Unix patch onto a DOS file.
ここにリンクがあります http://www.chemie.fu-berlin.de/chemnet/use/info/diff/diff_2.html
--ignore-all-space' オプションは
-w' and
、1 つのファイルに空白があっても、他のファイルには空白がない場合でも違いを無視します。空白文字には、タブ、改行、垂直タブ、>フォーム フィード、キャリッジ リターン、およびスペースが含まれます
次のように diff を実行します。diff -w file1.txt file2.txt
git diff
この問題は、コンソール出力から LF を含むパッチ ファイルに手動でコピー アンド ペーストされた差分で発生しました。そのパッチ ファイルを再び機能させるには (CR と LF を使用していた実際のファイルに適用できるようにするには)、いくつかのことを手動で行う必要がありました。
joe
構文の強調表示は、ハンクを修正するとすぐに適切に色付けされるため、非常に役立ちました。