Here’s the scenario I’m currently running into:
- Programmer A (Using a Mac Version of Dreamweaver) edits file client.php and commits that file to the production branch of Project Foo’s repository
- Programmer B (Using a Windows Version of Dreamweaver) edits file client.php to fix a bug in the that file. He then does a
cp clientInfo.php ../prod-branch/clientInfo.phpto take that bug-fix from his working copy to the production branch. - Programmer B then does an
svn diff ../prod-branch/clientInfo.phpto see what svn says his changes were only to discover that svn says he’s changed every line in the file!
Now, this is what I believe is happening:
When the file gets edited by Mac, Dreamweaver on Mac replaces all the Windows newline characters with Mac newline characters so that it’s readable in Dreamweaver. In short, Dreamweaver has altered every line in the file. Now, once the commit is done, svn sees that every line of the file has changed and marks this fact down. When the windows programmer makes a change and the newline characters get changed again, svn thinks that, again, every line has changed.
My question is this: How can we prevent this from happening? I know there’s no way to undo the damage that’s already been done, but I want to prevent this from happening in the future.
Dreamweaver has an option to set which line break type it uses. Edit (on Mac: Dreamweaver ) -> Preferences, Code Format, Line break type.
Get your users to have the same setting, and things should play a little better together. It would be better, of course, if you can set your source control to ignore line break differences.