If you're a user of VS.NET 2005 with the TFS Power Tools and work with files edited in both Windows and Unix, you may find some odd results with the recursive Compare tool, which I believe uses TreeDiff and DiffMerge combined. The issue is, when you setup Compare to ignore end of line characters (/ignoreeol), which you need to do as Windows uses Carriage Return (CR) + Line Feed (LF) and Unix only uses LF, the Tree Difference does not honor the /ignoreeol settings. Nor do we find a way to tell TreeDiff to ignore EOL. Below you'll find the steps to reproduce and my opinion on why this is wrong. I've submitted this to Microsoft so you can get the details here.
1) Open a file in Window's Notepad and enter two lines of txt. (e.g. c:\temp\CRLF\test.txt)
2) FTP file in binary mode to UNIX machine.
3) Run cat -v on file (e.g. cat -v test.txt) to see the ^M which shows the carriage return.
4) Run dos2unix on file (e.g. dos2unix test.txt) to remove ^M
As an alternative, you can also transfer the file to Unix in ASCII mode which removes the ^M
5) Transfer the file back to Windows to a different directory (e.g. c:\temp\LF) in BINARY mode, which will not add the ^M back in (e.g. c:\tmp\LF\test.txt).
6) Edit your VS.NET 2005 Compare Tool (i.e. DiffMerge) to /ignoreeol See my post for details on how to do that.
7) Now use the Right Click, Compare tool in VS.NET 2005 with Power Tools add-in to compare directories c:\temp\LF and c:\temp\CRLF.
The Tree Difference will show the files are different, but if you Right Click, Compare Files, you should get "The Files are identical" as it now remembers you included /ignoreeol in our compare settings.
This is incorrect as the Tree Difference should also honor your Compare setting overrides (or allow overrides itself) and not flag the files as different.
Thursday, October 18, 2007
Bug in the Power Tools recursive "Compare" utility (i.e. TreeDiff) when working with Windows and Unix ASCII files.
Posted by Mac Noland at 7:55 AM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment