How to git decide which version of svn to use in git-svn?

I installed git and svn using homebrew on my Mac running 10.7.4. On my machine there is a svn version in /usr/bin that looks like the version used by git 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) 

So, can I change the version of svn that git-svn uses? If so, how do I do this?

Thank you for reading.

- Updated for comments -

 $ 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 
+6
source share
3 answers

I dug a little and it looks like git-svn uses perlersion perl bindings. After a little experiment, I found that installing an updated version of svn with perl support fixes the problem. On Mac OSX, it will look something like this:

 # 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 

Your problem boils down to the simple fact that your updated Subversion installation did not include perl companion modules, so git -svn returned to a more complete installation of the system.

To write symlinking / usr / bin / svn to / usr / local / bin / svn did absolutely nothing good. This has nothing to do with $PATH or anything else, and everything related to perl modules.

+7
source

Two versions of Subversion are installed on your system: 1.6.17 in /usr/bin/svn and 1.7.5 in /usr/local/bin/svn . When you run svn , it will check your $PATH correctly to pick it up in /usr/local/bin/svn , but git-svn does not bother and just uses the version in /usr/bin .

Looking through the code, there is nothing in git-svn.pl or Alien-SVN (the Subversion Perl library used by git-svn ) that explicitly points to any specific binary svn code, so I suspect that this is a β€œfunction” security, so don't look at your custom $PATH .

An easy option, if you have access, is to replace /usr/bin/svn with /usr/local/bin/svn ; possibly by deleting and replacing the symbolic link. Otherwise, I suspect that you will need to dig up the source of git-svn.pl and rewrite it to accept your custom $PATH .

+1
source

For those who reach here with the same problem: Now GIT has the ability to use the SVN version of Homebrew:

 brew install --with-brewed-svn git 

I hope for this help (I dug for a long time before finding it!)

0
source

Source: https://habr.com/ru/post/918017/


All Articles