Home > programming > svn diff when line endings are different

svn diff when line endings are different

If you’ve ever worked in mixed-OS environments, you surely ran across this very annoying problem:

A colleague of yours made a slight change to a file and committed it from his Windows computer. You however have modified that file too, on your Linux workstation. It so happens that the file in the repository and the file in your working copy have different line endings. Imagine the “pleasure” of doing a merge now :)

There is hope, though. You can do a SVN diff without taking line endings into consideration, by doing this:

1
svn diff --diff-cmd /usr/bin/diff -x "-u --strip-trailing-cr" yourfilename

This of course assume you have the diff utility installed in /usr/bin. For more about what svn diff can do, run svn help diff.

I’m now grepping the SVNBook for a way to automatically convert line endings upon commit, sort-of what CVS can do. If you know such a way, please share :)

Categories: programming
  1. No comments yet.
  1. No trackbacks yet.