# Copyright (C) 2009, 2011-2012 Free Software Foundation, Inc. # # Copying and distribution of this file, with or without modification, # in any medium, are permitted without royalty provided the copyright # notice and this notice are preserved. # LF vs. CRLF line endings . $srcdir/test-lib.sh require gnu_diff require sed use_local_patch use_tmpdir lf2crlf() { while read l; do echo -e "$l\r"; done } echo 1 > a echo 1b > b diff a b | lf2crlf > ab.diff echo 1 > c check 'patch c < ab.diff' < ab.diff echo 1 > c check 'patch c < ab.diff' < ab.diff echo 1 > c check 'patch c < ab.diff' < ab.ed | lf2crlf > ab.ed echo 1 > c ncheck 'patch c < ab.ed' fi # ============================================================== echo 1 | lf2crlf > a echo 1b | lf2crlf > b diff a b > ab.diff cp a c check 'patch c < ab.diff' < ab.diff cp a c check 'patch c < ab.diff' < ab.diff cp a c check 'patch c < ab.diff' < ab.diff cp a c ncheck 'patch c < ab.diff' fi check 'cat -ve c' < a echo 1b > b diff a b | lf2crlf > ab.diff cp a c check 'patch --binary c < ab.diff || echo status: $?' < c check 'patch --binary c < ab.diff' < ab.diff cp a c check 'patch c < ab.diff' < c check 'patch --binary c < ab.diff' < ab.diff cp a c check 'patch c < ab.diff' < c check 'patch --binary c < ab.diff' < a echo 2 > b diff -u a b | sed -e 's,@@$,@@ context\r,' > ab.diff echo 1 > c check 'patch c < ab.diff' <