Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Let's say I create a symbolic link file inside an SVN managed path, commit the path to SVN and later checkout the path.

1) Will the symbolic link file survive?

2) If the symbolic link file is made up of a relative path, will it work "everywhere" a checkout is done?

3) Are there gotchas ?

share|improve this question

4 Answers 4

up vote 14 down vote accepted

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.

share|improve this answer
    
Since I am a big user of Subclipse, this answer makes more sense for me. –  jldupont Sep 29 '09 at 17:58
    
Actually, Subclipse will create symlinks if you're checking out a working copy on Unix or Linux system--we use this all the time where I work (see John T's response). –  bedwyr Oct 1 '09 at 3:13
    
@bedwyr - I'm using Eclipse w/ subclipse at work - on a unix system (Snow Leopard) - and I get folders. Commandline works, other clients work, just not subclipse. –  davethegr8 Oct 1 '09 at 22:38
    
I can't speak for Subclipse as I'm not a user of it, but from the command line, in at least version 1.6.11, I didn't have to do anything special to make it work. I created a symlink in a directory under version control, then committed it as normal. I a fresh checkout of the project the symlink was available and worked as normal. –  Matt Setter Jan 17 '12 at 10:58

From Windows 7 onwards, the OS understands symbolic links; see here for some documentation. The regular SVN clients under Windows do not yet support this, but svn under cygwin does!

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer
4  
stupid windows! –  Felipe Alvarez Aug 12 '10 at 11:33
1  
although ntfs would support the feature ;) only nearly nobody knows it... –  user375251 May 31 '12 at 13:32
    
Windows supports true symlinks through the mklink command, available since Vista –  Brad Cupit Jul 22 at 12:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.