Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if I add a symbolic link to subversion?

Tags:

svn

I'd like to add a symbolic link to subversion and when I do a checkout all it does is add the same symbolic link right to my checkout but I'm afraid to add it if that's not what happens.

like image 719
tooshel Avatar asked Oct 29 '10 21:10

tooshel


People also ask

What is the point of symbolic links?

A symlink is a symbolic Linux/ UNIX link that points to another file or folder on your computer, or a connected file system. This is similar to a Windows shortcut. Symlinks can take two forms: Soft links are similar to shortcuts, and can point to another file or directory in any file system.

Will removing a symbolic link remove the file?

When you remove a symlink, the file it points to is not affected. Use the ls -l command to check whether a given file is a symbolic link, and to find the file or directory that symbolic link point to. The first character “l”, indicates that the file is a symlink.

Do symbolic links have permissions?

1 Answer. In short: symlinks does not have permissions.

Should I use symbolic link or hard link?

Differences between soft and hard links:Symbolic links can be made between different file systems, hard ones cannot. Hard links share the inode number, symbolic links do not. With symbolic links, if the original file or directory is deleted, the information is lost, with hard links it is not.


1 Answers

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.

like image 135
David W. Avatar answered Sep 29 '22 11:09

David W.