What happens if I add a symbolic link to subversion?

I would like to add a symbolic link to subversion, and when I check, all she does is add the same symbolic link directly to my checkout, but I'm afraid to add it if it is not.

+50
svn
Oct 29 '10 at 21:38
source share
8 answers

It will work for so long if you are on a Unix / Linux based platform when you check it out. Good luck on Windows because it does not support symbolic links.

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

+13
Nov 01 2018-10-11T00:
source share

Windows Vista, Windows 7, and Windows 8 support true symbolic links in the NTFS 1 file system. These symbolic links are fully compatible with Unix file system symbolic links.

I want to emphasize the above. Too many people mistakenly believe that Windows does not support symbolic links.

This misinformation occurs because Windows 2000 and Windows XP do not support symbolic links. They supported Directory junction points, but not POSIX-style symbolic links. Even stranger, neither Windows 2000 nor Windows XP came with the required linkd command to create these Directory connection points.

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

Now at the heart of the problem:

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

I do not recommend putting symbolic links in the repository, even if you only work on Windows, not Windows. Instead, you need your build and / or deployment steps to create any necessary symbolic links. This gives you great flexibility, since you can test your OS during build or deployment and deal with any issues.

In addition, creating symbolic links during the build / deploy phase creates fewer maintenance headaches than having it in your repository. Imagine if I rename, move or delete a file with a symlink pointing to it in my repository. I also have to remember any symbolic links and change them too - something that is unlikely to happen. After all, it is impossible to browse a file and find out all the symbolic links that may point to this file.

So, how to recap:

  • Windows supports symbolic links compatible with POSIX style system symbolic links.
  • Subversion still does not support symbolic links in Windows.
  • If you need symbolic links, create them during assembly / deployment as part of the process as part of build / deployment scripts, and not as a repository artifact.



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

+107
Sep 18 '13 at 2:46 on
source share

Nothing happens if you add a symlink from Linux or another POSIX OS. It just works.

But when you try to add a symbolic link from Windows, you will see

 C:\repo>svn add test_link svn: E200007: Symbolic links are not supported on this platform 

I assume that since Windows requires the UAC to create a symbolic link. If Subversion allows a symlink in Windows, UAC will break the normal svn up .

+10
Sep 18 '13 at 0:20
source share

I might have missed this in other answers, but thought I could add.

Windows 7 Client:

TortoiseSVN 1.8.7, Build 25475 - 64 bit, 2014/05/05 20:52:12
Subversion 1.8.9, -release

Linux client:

svn version 1.6.17 (r1128011)

Symbols not only survive, but can also be created and edited in the repository from Windows. You just need to create a file with the following contents and SVN svn:special property svn:special = * .

 link name_of_source_file 

When you verify this with an SVN client that knows how to create symbolic links, you will create one for you. The Windows 7 client creates text files, but the Linux client creates symbolic links.




In response to the zb226 comment:

An “SVN client that knows how to create symbolic links” is a binary file that was created from a source that was written to use a function that knows how to create a symbolic link in a file system that has the concept of symbolic links.

Quick look The Subversion 1.8.13 source shows on line 608 io.c using symlink , which I don’t know exist in standard Windows libraries.

Another answer indicates that there is a program called mklink that can be used to create a symbolic link to Windows 1 . In C and C ++, you should usually include a library instead of calling a program that may or may not exist. It looks like Microsoft has a similar CreateSymbolicLink function, but it looks very immature. I don’t see anything about whether it works on NTFS, which will support 99.9% of the working SVN directories on Windows that I expect. He mentions ReFS , but I don’t think it will be used normally anymore.

In general, it seems that the existence and stability of symbolic links in Windows with NTFS does not exist, so Subversion developers have not yet added code to use the equivalent Windows commands.

When (or if) symbolic links become an everyday part of Windows, I expect them to migrate to Subversion's Windows clients. Most of the people I know who work only on Windows don’t even know what a symbolic link is, and the people I know who work with non-Windows OS, few people know that Microsoft is experimenting with them.

<sub> 1. The documentation for mklink says that it refers to "Windows Vista, Windows Server 2008, Windows Server 2012, Windows 8" and strangely omits Windows 7. I assume that it actually means that it exists and only works on certain versions of Windows that have certain versions of NTFS that support symbolic links. I do not think that symbolic links always existed in NTFS. Sub>




I just noticed that the Github Git for Windows client supports Windows NTFS symlinks. They even provide instructions on how to turn it on! Another nail to add to the Subversion coffin.

+9
Jun 17 '15 at 9:32
source share

Well ... I'm not sure about the technical answer or what the consequences may be, but I just tried. I created a sim link to the directory at the box office that I had. Added and committed. Found the whole check. Reinstalled it, and the sim link still exists with the corresponding link.

Hope that will be enough for your worries;)

+6
Oct 29 '10 at 21:44
source share

When a symbolic link is passed to the Subversion repository, Subversion remembers that the file was actually a symbolic link, as well as the object that the "link" points to.

When this symbolic link is checked for a different working copy on a system other than Windows, Subversion restores the symbolic link at the real level of the file system from the version with link symbols.

But this in no way limits the usability of working copies on systems such as Windows that do not support symbolic links. On such systems, Subversion simply creates a plain text file whose contents are the outline that the original symbolic link points to. Although this file cannot be used as a symbolic link on a Windows system, it will also not prevent Windows users from performing other Subversion related activities.

Taken from svn-book

+4
May 13 '15 at 6:55
source share

faq says that the reason why symbolic links are not supported in windows is because by default, administrators can create symbolic links.

+2
Aug 23 '17 at 0:44
source share

Yes, I can confirm that SymLinks version control works correctly in Subversion.

0
Jul 04 '19 at 23:09 on
source share



All Articles