nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

"Use of uninitialized value $u" #50

Open mickaelistria opened 12 years ago

mickaelistria commented 12 years ago

Hi,

While giving a try to svn2git on my local machine for JBoss Tools repo - which is quite huge, I got the following error, that I don't understand:

$ /var/lib/gems/1.8/bin/svn2git -v http://anonsvn.jboss.org/repos/jbosstools Running command: git svn init --prefix=svn/ --no-metadata --trunk=trunk --tags=tags --branches=branches http://anonsvn.jboss.org/repos/jbosstools Running command: git svn fetch Found possible branch point: http://anonsvn.jboss.org/repos/jbosstools/trunk => http://anonsvn.jboss.org/repos/jbosstools/branches/jboss, 78 Use of uninitialized value $u in substitution (s///) at /usr/lib/git-core/git-svn line 1728. Use of uninitialized value $u in concatenation (.) or string at /usr/lib/git-core/git-svn line 1728. refs/remotes/svn/trunk: 'http://anonsvn.jboss.org/repos/jbosstools' not found in ''

The first time I run this command, I could see the files being fetched. Now I don't see the fetch occur (probably files are cached), but I always get this issue.

Could someone help me on this?

nirvdrum commented 12 years ago

It looks like that error is coming from git-svn. svn2git ultimately wraps around git-svn, which is some perl script shipped with git proper. Off-hand I'm not sure what that error is related to.

mickaelistria commented 12 years ago

Thanks, I'll ask git-svn folks.

On Thu, Feb 2, 2012 at 5:31 PM, Kevin Menard < reply@reply.github.com

wrote:

It looks like that error is coming from git-svn. svn2git ultimately wraps around git-svn, which is some perl script shipped with git proper. Off-hand I'm not sure what that error is related to.


Reply to this email directly or view it on GitHub: https://github.com/nirvdrum/svn2git/issues/50#issuecomment-3780981

marcjay commented 12 years ago

Updating to the latest version of git (from 1.7.5.4 to 1.7.8.4) solved this issue for me.

ctapmex commented 12 years ago

look this solution http://groups.google.com/group/msysgit/browse_thread/thread/ecc415c113bed8de#

jean commented 12 years ago

Madden's hack, referenced by @ctapmex, worked for me when importing https://svn.plone.org/svn/collective/buildout/collective.recipe.supervisor/ svn2git (2.2.1)

plentz commented 12 years ago

@ctapmex tip did the trick. thanks!

abdul commented 11 years ago

@ctapmex, it works for me. thanks.

developdaly commented 11 years ago

@ctapmex worked for me as well!

duncanj commented 11 years ago

@ctapmex and for me too, thanks! Google groups link changed to https://groups.google.com/forum/?fromgroups=#!topic/msysgit/7MQVwRO-2N4

mateor commented 11 years ago

Worked for me as well, exact same failure but at line 106 in /usr/share/perl5/Git/SVN.pm

anselmdk commented 11 years ago

Seems to work for me as well, at least it doesn't die. This is what needs to be done (though it feels a bit edgy editing git core files...):

Hey guys, I thought maybe I'd have a look at that line 2097 and see if there was anything I could do about it myself. I was able to determine that, in this specific case, the variable $u was not defined (or something). So, without knowing much about what's actually going on there, I changed this: 

$u =~ s!^\Q$url\E(/|$)!! or die 
        "$refname: '$url' not found in '$u'\n"; 

to this: 

if(!$u) { 
        $u = $pathname; 
}else { 
        $u =~ s!^\Q$url\E(/|$)!! or die 
        "$refname: '$url' not found in '$u'\n"; 
} 

and then just hoped for the best. So far it seems to be working. I'm getting some "Couldn't fine revmap" messages but I don't know if that's something I should be concerned about. Anyway, I don't know if this is a proper solution but I hope will help in some way. 
if6was9 commented 11 years ago

@mateor I ran into this as well.

@anselmdk thanks for the fix

Like you, I'm not sure whether this is the most appropriate fix to the underlying root cause or not.

I created a fork of git and applied this patch to support some conversions I am doing. I applied the fix to 1.8.2.3 and master.

https://github.com/if6was9/git/commit/364c42061ade26469f47980bf768d625099b866a

I'm going to submit to the patch to the git mailing list and see what they say.

jaolho commented 11 years ago

Editing the config file worked for me: http://stackoverflow.com/a/17827367/2613458

chung-leong commented 10 years ago

In my case, editing the config file makes it work for a bit, then it fails again. The fix posted by anelmdk allows the process to go the whole way.

boxerab commented 9 years ago

+1 for anselmdk 's fix

leeplay commented 9 years ago

+1 for anselmdk 's fix :)

archibaldovitch commented 9 years ago

Why can't this fix make its way upstream ?

amedee commented 9 years ago

@mickaelistria what was the result of you contacting the git-svn people? Who did you contact?

The fix proposed by @anselmdk does not work for me, because I have the error at line 106, see #99

@archibaldovitch I think the reason is because upstream has not been contacted yet, and/or nobody knows who to contact at upstream, and how. Maybe?

tbowden commented 6 years ago

As I reported here: https://github.com/nirvdrum/svn2git/issues/66#issuecomment-365207950

Fix for me was making sure I was running svn2git in a genuinely empty directory ("rm -rf .git") if a previous attempt had aborted for some other reason.