Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
456 views
in Technique[技术] by (71.8m points)

svn - What happens if I add a symbolic link to subversion?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...