title: diff and patch using wrong line ending when creating new files or line end changed
body: <p>I'm trying to create a patch using diff, but I can't get the patch to use the line end characters used in the files when creating a new file or to change the line ending when the file changes it.  Basically, I'm doing:</p>
  
  <pre><code>cp -r dir1 dir3
  diff -ruN dir1 dir2 &gt; dir3\patch.txt
  cd dir3
  patch -p1 &lt; patch.txt
  </code></pre>
  
  <p>All the changes between <code>dir1</code> and <code>dir2</code> properly apply, except the end of line character for new files is defaulting to <code>CR+LF</code>, even where the file in <code>dir2</code> uses <code>LF</code> as an end of line marker.  Also, any files where the difference between them is just a line end change are not patched in any way -- diff doesn't seem to see any change.</p>
  
  <p>So running <code>diff -rq dir2 dir3</code> gives a bunch of <code>Files aaa and bbb differ</code>, but <code>diff -rwq dir2 dir3</code> works fine.</p>
  
  <p>I'm using <code>diff - GNU diffutils version 2.7</code> and <code>patch 2.5</code> from <code>UnxUtils</code> on Windows XP.</p>
  
  <p>Is there any way to make new and changed files included in the patch keep the line ending from the original file?</p>