I’m a regular Subversion user, specifically TortoiseSVN and VisualSVN, but I’m also a big fan of Windows Search, particularly with all the improvements introduced in Windows 7. However, when Windows Search indexes areas of the file system where you’ve checked out a Subversion repository to, then by default it will index the checked out files and the base files that Subversion keeps in the hidden .svn directories. In addition it indexes all the other files in the .svn directories. This means you can get a slightly odd search experience as you often get garbage in the results and two hits for every matching file, one that’s the file you’re looking for and one that’s the base file in the .svn directory.


Search results with duplicate entries


So, what’s the solution? Well one solution is to slightly alter the query you use when searching directory hierarchies that contain Subversion managed files. Just add -folder:\.svn to the end of the query.


Correct search results


It’s the correct set of results, but this isn’t ideal. What would be better is if Windows Search didn’t index the .svn directories in the first place. Unfortunately the user interface for managing Windows Search is quite basic and it’s not possible to add a rule that says exclude all directories named .svn anywhere they are encountered. You can only exclude specific .svn directories, and this isn’t practical.


I’m left wondering if there’s some way to achieve this through the Windows Search SDK? An interesting exercise for the future I think!

[Originally posted by Rupert Benbrook on 22nd August 2010 here: http://phazed.com/]