6

我已经在运行 10.7.4 的 Mac 上安装git并使用自制软件。我的机器上svn有一个版本似乎是正在使用的版本。svn/usr/bingit svn

$ git --version
git version 1.7.10.4

$ svn --version
svn, version 1.7.5 (r1336830)

$ git svn --version
git-svn version 1.7.10.4 (svn 1.6.17)

$ /usr/bin/svn --version
svn, version 1.6.17 (r1128011)

那么,我可以更改 git-svn 使用的 svn 版本吗?如果是这样,我该怎么做?

谢谢阅读。

--更新评论--

$ which git svn
/usr/local/bin/git
/usr/local/bin/svn

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/git/bin
4

3 回答 3

7

我做了一点挖掘,看起来 git-svn 使用了颠覆的 perl 绑定。经过一些实验,我发现安装启用 perl的升级版 svn 可以解决问题。在 Mac OSX 上,这将是这样的:

# First, I had to take ownership of the perl libs dir,
# so homebrew could create perl modules
chown $USER -R /Library/Perl/5.12/darwin-thread-multi-2level

# Then, remove and reinstall Subversion, but add the perl option:
brew remove svn
brew install --perl svn

# Lastly, reinstall git (this may be optional, but it may also help.)
brew remove git
brew install git

您的问题归结为一个简单的事实,即您更新的 Subversion 安装不包括随附的 perl 模块,因此 git-svn 依赖于更完整的系统安装。

作为记录,将 /usr/bin/svn 符号链接到 /usr/local/bin/svn 绝对没有好处。这与 perl 模块无关,$PATH也与 perl 模块有关。

于 2012-06-15T05:33:58.490 回答
1

Your system has two versions of Subversion installed: 1.6.17 in /usr/bin/svn, and 1.7.5 in /usr/local/bin/svn. When you run svn, it parses your $PATH correctly to pick up the one in /usr/local/bin/svn, but git-svn doesn't bother, and just uses the version in /usr/bin.

Having had a quick glance through the code, there's nothing in git-svn.pl or Alien-SVN (the Perl Subversion library that git-svn uses) that explicitly points to any particular svn binary, so I suspect it's a security "feature" to avoid looking at your custom $PATH.

The easy option, if you have access, is to replace /usr/bin/svn with /usr/local/bin/svn; possibly by deleting and replacing with a symlink. Otherwise, I suspect you'll need to dig into the source of git-svn.pl and rewrite it to accept your custom $PATH.

于 2012-06-14T09:48:54.120 回答
0

对于那些遇到同样问题的人:现在 GIT 可以选择使用 Homebrew 的 SVN 版本:

brew install --with-brewed-svn git

希望有帮助(我挖了很长时间才找到它!)

于 2016-08-30T14:51:34.607 回答