Subversion and those annoying .svn directories.
Nearly a year ago I wrote about a Load-Bearing Kludge. In that article I talked about how we implemented a work-around for getting rid of those pesky .svn directories that Subversion uses for meta-data. The solution wasn't to get around them, but to relocate them. To do this I had to create a shared library that intercepted and decorated a few low-level C library functions like open, fopen, unlink, and a few others.
Since that article last February I've received quite a few requests for the source code that did this. It isn't anything spectacular and in fact the code was abandoned for a much better solution of not using Subversion at all. At any rate, I just received approval from Matt Lightner, the CEO of Site5 to go ahead and give it away. So here it is.
The code
Build it
The provided Makefile is the simplest of Makefiles. It knows how to build the .so, only using gcc. AFAIK this code will not easily work on Windows.
Just copy the fix_dotsvn.c and Makefile into a directory and run make. This should create fix_dotsvn.so.
Use it
fix_dotsvn.so will reroute all ".svn" directory access to whatever directory specified in the environment variable "DOT_SVN_PREFIX", which defaults to "/backup/svn_home". Change it to wherever you would like to reroute your .svn's.
To load it, set your LD_PRELOAD environment variable to /path/to/fix_dotsvn.so before running the svn command. Example:
$ LD_PRELOAD=/path/to/fix_dotsvn.so svn update
That's all folks
That's really all there is to it. It worked perfectly while we used it.
Comments
None yet.
Post a comment