What happens if I add a symbolic link to subversion?

Windows Vista, Windows 7, and Windows 8 all support true symbolic links on the NTFS file system1. These symbolic links are entirely compatible with Unix file system symbolic links

I want to emphasize the above. Too many people wrongly believe that Windows doesn't support symbolic links.

This misinformation comes about because Windows 2000 and Windows XP did not support symbolic links. They supported Directory Junction Points, but not POSIX style symbolic links. Even more weird, neither Windows 2000 or Windows XP came with the required linkd command to create these Directory Junction Points.

This is no longer true. Windows Vista, Windows 7, and Windows 8 not only support symbolic links, but also come with the required mklink command. These symbolic links are compatible with POSIX compatible operating system symbolic links (Mac OS X, Linux, Unix)

Now to the heart of the problem:

Although Windows now supports symbolic links, and those symbolic links are compatible with Unix/Linux/Mac symbolic links, Subversion itself does not support symbolic links on Windows. I have no idea why this is the case.

I don't recommend putting in symbolic links into the repository, even if you only work in POSIX style OS systems and not Windows. Instead, you should have your build and/or deploy steps create any required symbolic links. This gives you more flexibility since you can test your OS during a build or deployment and handle any issues.

Plus, creating symbolic links during the build/deploy stage creates less maintenance headaches than having it in your repository. Imagine if I rename, move, or delete a file that has a symbolic link pointing to it in my repository. I have to also remember to look for any symbolic links and modify them too -- something that's not likely to happen. After all, it's impossible to look at a file and know all of the symbolic links that maybe pointing to that file.

So as a recap:

  • Windows supports symbolic links where are compatible with POSIX style system symbolic links.
  • Subversion still does not support symbolic links on Windows.
  • If you want symbolic links, create them during the build/deploy part of your process as part of your build/deploy scripts, and not as a repository artifact.

1. Yes, I know that the FS in NTFS stands for file system.


It'll work as long a you're on a Unix/Linux based platforms when you check it out. Good luck on Windows since it does not support symbolic links.

See the note on this page in the SVN Book about symbolic links for more information.

Tags:

Svn