哪些 SCM 支持 Windows 和 Linux 下的符号链接?
我发现 subversion 不支持 Windows 下的符号链接。
我想知道是否有人知道能够在 Windows 和 Linux 下使用符号链接的 SCM 工具?
SCM 工具目前在 Windows 下缺少符号链接支持:
- Clear Case
- Subversion
- Mercurial
- Perforce
I found out that subversion doesn't support symlinks under Windows.
I'm wondering if somebody knows a SCM tool that is able to work with symlinks under both Windows and Linux?
SCM tools currently missing symlink support under Windows:
- Clear Case
- Subversion
- Mercurial
- Perforce
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
大多数 SCM 专注于存储规范化数据(将 SCM 视为数据库)。这意味着它们存储源文件和构建脚本,而不是存储从它们派生的可执行文件。人们可以同时存储两者,但这会导致不必要的重复。
类似地,符号链接是对其他文件的引用,并代表与数据规范化类似的问题。
此外,一般来说,指针很难推理。在 SCM 中添加对指针(符号链接)的支持意味着某些操作需要检查符号链接指向的位置并采取相应的操作。这使得合并变得更加困难,添加/更新符号链接很棘手,因为您需要弄清楚它指向哪里(在存储库中与在存储库外,到同一文件的两个符号链接等)。
由于这些原因,大多数 VCS/SCM 不允许您管理符号链接。大多数 SCM 确实支持用户定义的挂钩。使用自定义挂钩或其他脚本来管理符号链接是一种更好的方法,因为这意味着 SCM 不必对它们进行推理(它们对它们一无所知),并且您可以回避它们创建的数据规范化问题。
因此,总而言之,您最好编写管理符号链接的脚本,然后在适当的时间调用这些脚本(克隆/签出、更新/提交等)。
Most SCM focus on storing normalized data (think of your SCM as a database). This means that they store source files and build scripts instead of storing executable files derived from them. People could store both but it leads to unnecessary duplication.
Similarly, symlinks are references to other files and represent a similar problem to data normalization.
Furthermore, pointers in general are hard to reason about. Adding support for pointers (symlinks) in a SCM means that certain operations will need to examine where the symlinks point and act accordingly. This makes merges harder, adding/updating symlinks is tricky because you need to figure out where it points (in repo vs. out of repo, two symlinks to same file, etc).
For these reasons, most VCS/SCM do not allow you to manage symlinks. Most SCM do have support for user defined hooks. Using custom hooks or other scripts to manage the symlinks is a better approach because it means the SCM doesn't have to reason about them (it's ignorant to them), and you are side-stepping the issue of data normalization that they create.
So, in conclusion, you're best off writing scripts that manages your symlinks and then calling those at the appropriate times (clone/checkout, update/commit, etc).
Git本身本地处理符号链接(symbolic links);我在这里的意思是 Git 在存储库中存储文件符号链接的信息。
我认为 Git for Windows (msysGit) 可以表示符号链接NTFS 上的工作目录。还有
core.symlinks
配置变量,如果为 false,则 Git 签出符号链接时会签出为包含链接文本的小纯文件。创建存储库时(git clone
或git init
),Git 将在适当的情况下探测并设置“core.symlinks”为 false。Git itself handles symlinks (symbolic links) natively; I mean here that Git stores information that file is symlink in repository.
I think that Git for Windows (msysGit) can represent symlinks in working directory on NTFS. There is also
core.symlinks
configuration variable, that if false makes Git check out symbolic links are checked out as small plain files that contain the link text. Git will probe and set 'core.symlinks' false if appropriate when the repository is created (git clone
orgit init
).