From: Earnie B. <ea...@us...> - 2005-08-05 14:15:27
|
Subject: Line endings and diff <file name="foo1.txt"> foo\n </file> <file name="foo2.txt"> foo\r\n </file> <command action="diff -u foo1.txt foo2.txt"> <result> --- foo1.txt Fri Aug 5 09:43:49 2005 +++ foo2.txt Fri Aug 5 09:44:17 2005 @@ -1 +1 @@ -foo\n +foo\r\n </result> </command> I've set up the above example to discuss what the Community would wish MSYS diff to do in the above. Current MSYS diff executes as seen above and thus works the same as if you were to execute the command on a UNIX OS. Others have asked that \r\n be treated equivalent to \n even though in reality the files are different. Options for change: 1) No change. 2) Treat \n and \r\n the same regardless** ***. 3) Treat \n and \r\n the same unless some special switch is applied** ***. 4) Treat \n and \r\n as different unless some special switch is applied* ** ***. 5) Supply a native version of diff instead of the MSYS diff***. 6) Supply a native version of diff renamed to mingw32-diff***. * Current MSYS diff -w or -b will treat \r as white space but if you want white space differences then this doesn't work well. ** If these changes are accomplished the output line endings would still retain the line ending in the respective file if other differences are found. Modifcations to patch may also need to happen. *** There is danger of introducing \r\n when the files do not contain them originally if patch is used to apply the difference elsewhere. The people having the most problems are those using native tools that spawn MSYS processes. Another place where the current MSYS diff presents a problem is when doing the unit tests when a comparison file is used to find a regression (such as is used by GNU make). So, I'm looking for ideas and suggestions. Earnie |