tags:

views:

1151

answers:

3

I have a project in SVN which has a plugins folder. Several of the plugins folders are git repositories -- I added them to my plugins folder using git clone.

This has been working well for me but now I'm looking to migrate my SVN repository to git using git-svn:

git svn init http://path/to/my/repo --no-metadata 
git config svn.authorsfile ~/authors.txt
git svn fetch

This works fine for all my early revisions which didn't have the git repos in my plugins folder, but when it hits the first revision containing a git repository it fails with the following error:

trunk/plugins/my_plugin/.git/HEAD was not found in commit 
ae9ad0ab7cebd144c823d90d43cdab2b30d13f9e (r2259)

Is there a way around this to allow me to fully import my repository, perhaps by excluding any .git folders which reside in the SVN repository?

A: 

You could dump the current svn repo, filter out the .git directories, and create another svn repo based on this filtered dump, and use this new one as a basis for the git repo.

Parallel use of git and svn would probably be interesting - you'd have to replace the existing repo with new gitless one, and the missing .git directories could cause some hassles.

I have not tried this, so you're going to want to be careful, and have backups.

Cebjyre
A: 

Due to the way Git works, having more than 1 .git folder will cause you problems (well, you already know that hehe).

You have 2 options: - if you don't care about story, do it the easy way: remove the .git folders from svn and move to git the full project

  • if you care about story, do it the hard way: check this link and follow the steps

I know my team leader had some issues with that, but it works.

EDIT: I forgot to mention another way: you might use Bazaar to pull the project, as it interacts with both. Not sure if that would be easier though

Pere Villega
+2  A: 

It turns out that I was using git-svn 1.5 on Ubuntu which didn't support the --ignore-paths flag on git-svn fetch. After building git 1.6 from source I can now run:

git svn fetch --ignore-paths='\.git'

The fetch now ignores all .git folders and successfully imports all the SVN history to my new git repository.

Olly