2007-06-30

Ignore Whitespace with Subversion Diff

subversion.png

My team at work uses Subversion (SVN) for our version control system. I like Subversion a lot and would recommend it over Concurrent Versions System (CVS) or Source Safe.

I've noticed one annoyance with Subversion when using the svn diff command. By default it does not ignore whitespace changes nor is there an option for this. My group uses different editors with different settings and the whitespace in our source code seems to change with every update. Some of us use tabs, some use spaces (like me) and it seems like everyone has a different indexing scheme. This means that using Subverion's diff command shows most of the code has having been changed witch makes it all but useless. The solution was found with an easy google search which lead me to this site that had a solution.

Basically instead of using svn diff you use:

svn diff --diff-cmd diff -x -uw FILE

To have this work with Emacs' psvn Subversion interface add the following to your Emacs config:

(require 'psvn)
(setq svn-status-default-diff-arguments '("--diff-cmd" "diff" "-x" "-wbBu"))

Happy version control!

OS X. Because it was easier to make Unix user friendly than to fix windows.

Tags: programming software subversion technology