git-svn clone or svn2git unexpectedly stopping

2020-03-03 05:51发布

问题:

I am trying to migrate from git to svn with the following command:

git svn clone --stdlayout https://my_sourcecontrol

or with git2svn

svn2git --notags https://sourcecontrol -v

During the migration, it just stops with the following statement:

W: -empty_dir: directory

When I do a git branch -a

I see it has imported the tags and a number of branches that were deleted some time ago. Also, it has not imported any of the existing branches only the ones that were deleted some time ago.

Can anyone shed any light on what is going on?

回答1:

You could experiment a bit with a smaller clone, only doing one branch at first to see if that works, for example.

I've seen a similar problem: After running for a couple of minutes, git-svn fetch (which runs under the hood of git svn clone) halts with "signal 13".

I don't see any error message in your output, but maybe it's different on Windows or something. Nonetheless, running git svn fetch should pick up where it left off. I made a little shell-script loop to run fetch until it's done (you need cygwin/*nix to run this):

while ! git svn fetch; do echo "git-svn halted. Restarting...i"; done


回答2:

This powershell version of the above *nix script worked for me:

$i = 1
do
{
    git svn fetch
    if( !$? )
    {
        Write-Host "git-svn halted. Restarting... $i++"
    }
    else
    {
        Write-Host "git-svn completed successfully"
    }
}
while( !$? )
Write-Host "git-svn fetch required $i iteration(s)"


回答3:

I had a similar problem.

In the early days of the SVN repo, I was using the default file structure of a trunk/ and tags/ folder at the top level. At a later date, I switched to a <project name>/trunk, <project name>/tags structure with multiple projects.

So using the --stdlayout switch only resulted in the earlier code being migrated (because the <project name>/* files were ignored).

Using -t <project name>/tags and -T <project name>/trunk solved the problem.



回答4:

It might be a case of SIGPIPE.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526989

Upgrade git to something like 1.8 or higher. I was getting this bug with 1.7 (since stable Debian has really old packages) and had to install latest git from source, which is 2.1.0.



标签: git git-svn