From: Leif W <war...@us...> - 2005-08-05 16:30:19
|
> "Earnie Boyd" <ea...@us...> > 2005 August 05 Friday 10:15 > > Subject: Line endings and diff [snip] > 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. My 2 cents (if I even get that much). Well, I think people should take care that their files have consistent line endings. If I have a doubt, I force line endings from "whatever" (\n|\r\n|\n\r) to whichever one I want it to be, with a simple sed or "perl -p -i -e". Sometimes line endings cause other programs to hiccup, scripts, config files and such. Those programs should follow the internet mantra, "be liberal in what you accept, and conservative in what you project". But sometimes they don't, and like their line endings a certain way. diff detects differences. Differnt line endings are differences and I want to detect them. Be conservative by default. Maybe have an option similar to the whitespace option that only fiddles with line ending character combinations. Use it for those instances when time is of the essence and you just can't sort out all those line endings and know they won't matter in the end. But what if some sl(op|ee)py coder who fat fingered? There's white space before the end of the line in a modified file ("... foo \t \t \r\n") and no whitespace in the original ("...foo\n"). That's still a difference, and may very well not affect anything, but it's still a difference due to sloppiness. Should we ignore that too? The program is called "diff", not "similar", "sloppy" or "lazy". :p Some bug later pops up and we use a recursive diff and find no differences, unless we look at file size and date. It could waste more time later than it saves up front. Leave diff's default alone, and if possible, add an option to ignore different line endings. Otherwise I think option 6, with a normal diff and an additional (intentionally broken?) mingw32-diff. Leif |