You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jeff Bowden <jl...@houseofdistraction.com> on 2004/03/17 20:01:24 UTC

dealing with symbolic links (symlinks)

I don't know if this has been covered here before but I thought I would 
offer my ad hoc solution for the (current) lack of support for 
symlinks.  My solution has three parts:

   1. a script to store all the symlinks in a .tar file
   2. a script to svn:ignore on all the symlinks
   3. a modification to the top level makefile of the project to unpack
      the symlinks

tar-up-symlinks.sh:

    #! /bin/sh
    rm -f symlinks.tar
    find . -type l -print0 | xargs -0 tar -rf symlinks.tar

recurse-set-ignore-not-added.sh:

    #! /bin/sh
    SET_IGNORE_NOT_ADDED=`pwd`/set-ignore-not-added.sh
    svn status | grep '^\?' | sed 's/?      //' | sed 's/[^/]*$//'|uniq
    | xargs -l $SET_IGNORE_NOT_ADDED

set-ignore-not-added.sh:

    #! /bin/sh
    echo $1
    cd $1
    svn propget svn:ignore . >.svnignore.tmp
    svn status -N | grep '^\?' | sed 's/?      //' >>.svnignore.tmp
    sort .svnignore.tmp|uniq>.svnignore.tmp2
    svn propset svn:ignore -F .svnignore.tmp2 .
    sed 's/^/        /' <.svnignore.tmp2
    rm .svnignore.tmp .svnignore.tmp2

Makefile rule addition:

    path/to/one/of/the/symlinks:  symlinks.tar
        tar mxf symlinks.tar

(and then of course, the 'build' rule of the Makefile needs to have 
path/to/one/of/the/symlinks added as a dependency)

All these files plus symlinks.tar reside in the top level of my 
project.   First I create symlinks.tar and add it to the repository, 
then I run the recurse-set-ignore-not-added script, change the Makefile 
and commit everything.

It's important to note that set-ignore-not-added will set ignore on 
everything that's not added, it isn't specific to symlinks.  So before 
you run it make sure that svn status doesn't show anything with a '?' 
that you don't want to ignore.

This has worked out pretty well for me so far.  I thought I would offer 
it up in case someone finds it useful or has some improvements to offer.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org