34

I'm trying to use git svn to clone a SVN repo into Git.

I run the following command:

C:\Projects>git svn clone -T trunk -b branches -t tags --no-metadata https://svn.mycompany.com/Projects/MyProject MyProject

And I get the following error:

Found possible branch point: https://svn.mycompany.com/Projects/MyProject/trunk => https://svn.mycompany.com/Projects/MyProject/tags/11.1.9.33334, 33334

Use of uninitialized value in substitution (s///) at /usr/lib/perl5/site_perl/Git/SVN.pm line 106.

Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/site_perl/Git/SVN.pm line 106.refs/remotes/MyProject-10.2: 'https://svn.mycompany.com/Projects' not found in ''

Version of git is:

1.8.1.msysgit.1

Alex
  • 37,502
  • 51
  • 204
  • 332
  • Just a hint: the `possible branch point` message is normal and no error. – eckes Mar 13 '13 at 14:39
  • Ok... But my repo folder doesn't contain trunk branches or tags.... The only thing in there is the .git folder – Alex Mar 13 '13 at 14:45
  • there's **no** tag `https://svn.mycompany.com/Projects/MyProject/tags/11.1.9.33334`? You should mention this... – eckes Mar 13 '13 at 14:55
  • What version of `git`? The `Use of initialized value ...` bits may indicate a bug... Maybe try a newer version... For that matter, what version of `svn` (although I'm not sure there's a direct dependency...)? – twalberg Mar 13 '13 at 15:00
  • Not sure what version of svn, but git is latest... Installed today. – Alex Mar 13 '13 at 15:32
  • @eckes could you elaborate a bit please.....? No tag? – Alex Mar 13 '13 at 15:32
  • @alexjamesbrown: in SVN, tags and branches are stored as folders. Usually, there's a `trunk` folder and some folders `branches/whatever` and `tags/whatever`. The output you posted looks like there's a tag called `11.1.9.33334` in your SVN repo... – eckes Mar 13 '13 at 15:54
  • ok... in the tags folder (when i look in repo browser) there are other folders: Clients, CoreProducts, release... i don't see a folder called 11.1.9.33334 – Alex Mar 13 '13 at 16:10
  • "Installed today" doesn't mean anything: if I install Git today on my Red Hat system, I get v1.7.1, on Debian I get v1.7.2.5, while on Cygwin I get v1.7.9. The actual latest version is v1.8.2, which was released yesterday, but you're very unlikely to have that unless you compiled it from source yourself. Just give us the output of `git --version`! – me_and Mar 14 '13 at 14:20
  • Was on my phone, so a little bit tricky to do that before. It's 1.8.1.msysgit.1 – Alex Mar 14 '13 at 15:40
  • I 'm experiencing exactly the same issue with Git 1.8.1.msysgit.1 – Mike Mar 20 '13 at 08:40

3 Answers3

72

My problem was that due to such a large SVN (files and log) that it kept crashing at some points and when I restarted it created multiple lines of the branches and tags within my .git/config file.

branches = branches/*:refs/remotes/svn/branches/*
tags = tags/*:refs/remotes/svn/tags/*

I simply removed the duplicate entries of these and restarted with my command

git svn fetch
Ryan Hayes
  • 5,290
  • 4
  • 42
  • 52
Phil Cook
  • 2,025
  • 19
  • 25
1

I had the same error and solved it by upgrading to git version 2.6.2.windows.1

Johan Gov
  • 1,262
  • 1
  • 13
  • 26
0

Same error. I am converting my SVN repository to Git.

git version 2.8.2.windows.1
Windows 8.1 Pro 64bits, running Git For Windows 32bits.

v1, trunk address is wrong, set by mistake to same as repository root:

C:\Windows\system32>git svn clone https://mycompany.svn.beanstalkapp.com/myproject 
        --no-metadata -A c:\temp\svn_to_git_users.txt 
        --trunk=https://mycompany.svn.beanstalkapp.com/myproject 
        --tags=https://mycompany.svn.beanstalkapp.com/myproject/tags 
        --branches=https://mycompany.svn.beanstalkapp.com/myproject/branches
        c:\code\Git_myproject

[...]
W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/MS WCSF Contrib/src/Services
W: +empty_dir: branches/20080918_DBDEPLOY/vendor/src/csharp/RealWorldControls/References
r530 = c276e3b039d8e38759c6fb17443349732552d7a2 (refs/remotes/origin/trunk)
Found possible branch point: https://mycompany.svn.beanstalkapp.com/myproject/trunk => https://mycompany.svn.beanstalkapp.com/myproject/branches/20080918_DBDEPLOY, 529
Use of uninitialized value $u in substitution (s///) at /mingw32/share/perl5/site_perl/Git/SVN.pm line 101.
Use of uninitialized value $u in concatenation (.) or string at /mingw32/share/perl5/site_perl/Git/SVN.pm line 101.
refs/remotes/origin/trunk: 'https://mycompany.svn.beanstalkapp.com/myproject' not found in ''

C:\Windows\system32>

v2 works: corrected the paths (and using relative instead of absolute to make line shorter)

C:\Windows\system32>git svn clone https://mycompany.svn.beanstalkapp.com/myproject 
        --no-metadata -A c:\temp\svn_to_git_users.txt --trunk=trunk 
        --tags=tags --branches=branches c:\code\Git_myproject
[...]
r529 = 40442d32486f4ca6f713e659b3785a446bd19de6 (refs/remotes/origin/trunk)
Found possible branch point: https://mycompany.svn.beanstalkapp.com/myproject/trunk => https://mycompany.svn.beanstalkapp.com/myproject/branches/20080918_DBDEPLOY, 529
Found branch parent: (refs/remotes/origin/20080918_DBDEPLOY) 40442d32486f4ca6f713e659b3785a446bd19de6
Following parent with do_switch
Successfully followed parent
r530 = 9fefc1b3a892555e315d55c2024cdf3d3a05010f (refs/remotes/origin/20080918_DBDEPLOY)
        A       src/database/sds.dbd
[...]

As suggested by others, I opened the config file (C:\code\Git_myproject.git\config) and the first version (broken) was as follow. The fetch is probably the wrong thing comparing with v2 (branches and tags are duplicated too, some people say it might also cause problems).

[svn-remote "svn"]
noMetadata = 1
url = https://mycompany.svn.beanstalkapp.com/myproject
fetch = :refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*

and the 2nd version (working) was:

[svn-remote "svn"]
noMetadata = 1
url = https://mycompany.svn.beanstalkapp.com/myproject
fetch = trunk:refs/remotes/origin/trunk
branches = branches/*:refs/remotes/origin/*
tags = tags/*:refs/remotes/origin/tags/*

Looking at svn.pm, I can see we're in find_parent_branch() which outputs the message "Found possible branch point". It then calls other_gs($new_url, $url, $branch_from, $r, $self->{ref_id}); which itself calls: Git::SVN->find_by_url($new_url, $url, $branch_from); which calls: resolve_local_globs($u, $fetch, $globspec); and resolve_local_globs is where the error is thrown on line 100/101:

my $u = (::cmt_metadata("$refname"))[0];
$u =~ s!^\Q$url\E(/|$)!! or die

I made a mistake in my command line for sure, fixing my trunk path removed the error. I never removed duplicate lines in the config file, they were adjusted automatically when re-running the command.

Thierry_S
  • 1,526
  • 16
  • 25