Do symbolic link files survive SVN?

From the Subversion Features page:

Symbolic links can be versioned.

Unix users can place symbolic links under version control. The links are recreated in Unix working copies, but not in win32 working copies.

  1. Yes

  2. As long as permissions aren't changed, it should.

  3. Won't work on Windows checkouts.


In general, Yes.

However, some clients don't work with symbolic links properly. Subclipse, for the Eclipse IDE, creates directories instead of symlinks.

So it's best to make sure your client is doing it right before getting into development.


Symlinks won't survive on a Windows machine, this can be a problem.
On Windows machines the symlinks take the form of placeholder files*), for example:

style.css:

link ../www_public/styles.css

*): these files have "svn:special" propery with a value of "*".

I sometimes have to export stuff to a windows machine before I can move/upload the project to it's destination server.

I use a small shell script that does a wonderful job at recreating the actual symlinks from the placeholder files:

#!/bin/sh

grep -lr '^link ' . | while read placeholderfile
do
  linecount=`wc -l $placeholderfile | cut -c1`
  if [ $linecount -eq 0 ] ; then
    linkfile=`cut -c6- "$placeholderfile"`
    ln -sf "$linkfile" "$placeholderfile"

    echo -e "[\E[32;40mOK\E[37;40m] Replaced $placeholderfile with symlink"
  else
    echo -e "[\E[31;40mWARNING\E[37;40m] $placeholderfile contains newline(s)"
  fi
  tput sgr0
done

This script works on the assumption that all files that start with the string "link" and do not contain newlines are symlinks.

Tags:

Linux

Unix

Svn