3
Using Cygwin on Win7x32, when I use sed
to replace some values in a file, git
then considers the entire file to be completely rewritten (i.e., 500 insertions, 500 deletions). What's going on here? Only one line in the file is actually changed, and the replacement value is the same length as the original. I'd expect git
to recognize only the lines that changed. The only thing that seems to have changed at all is the inode and time values as read from stat some/file.txt
. Is there a way to tell git
to ignore any relevant changed values for the duration of my sed
calls, or to tell sed
to not change any values that cause git
to see a file with entirely new content?
Using unix2dos helped, however somehow, now I have only replaced line ending in ^M, the rest is still LF. – VsMaX – 2016-10-21T05:55:51.730
1This looks like the culprit; before, the file is
ASCII C++ program text, with CRLF line terminators
, and after,ASCII C++ program text
. I was under the impression thatsed
didn't do any sort of automagical conversions like that, being a "stream editor," but oh well. – wes – 2012-03-06T18:41:43.487Does cygwin have the
unix2dos
tool? That'll put back the Windows end-of-line marker. – eduffy – 2012-03-06T18:51:09.153Yep, that's what I ended up using. Just a little surprised after hearing so many good things about
sed
. – wes – 2012-03-06T18:52:08.247