diff and patch using wrong line ending when creating new files or line end changed -
diff and patch using wrong line ending when creating new files or line end changed -
i'm trying create patch using diff, can't patch utilize line end characters used in files when creating new file or alter line ending when file changes it. basically, i'm doing:
cp -r dir1 dir3 diff -run dir1 dir2 > dir3\patch.txt cd dir3 patch -p1 < patch.txt all changes between dir1 , dir2 apply, except end of line character new files defaulting cr+lf, file in dir2 uses lf end of line marker. also, files difference between them line end alter not patched in way -- diff doesn't seem see change.
so running diff -rq dir2 dir3 gives bunch of files aaa , bbb differ, diff -rwq dir2 dir3 works fine.
i'm using diff - gnu diffutils version 2.7 , patch 2.5 unxutils on windows xp.
is there way create new , changed files included in patch maintain line ending original file?
this works:
cp -r dir1 dir3 diff --binary -run dir1 dir2 > dir3\patch.txt cd dir3 patch --no-backup-if-mismatch --binary -u -p1 < patch.txt not using --binary flag means file parsed line line, ignoring eol. reason, won't patch cleanly (gives hunk #1 succeeded @ 1 fuzz 1. message) had include --no-backup-if-mismatch prevent making .orig files. -u seems optional, since patch figure patch type out on it's own.
diff patch newline eol lf
Comments
Post a Comment