Question

I am trying to use git-bundle with a git-svn repo. Essentially, I need to create an offline git repo that has a clone of our production SVN system. The SVN repository is cloned through git-svn, which works great. It clones our code, and lists it under remotes/*.

Now the hard part. I need to keep this in sync with our offline repository. The offline environment has no internet access, and will only ever get updates via a one way method (ex. a cd, etc). It's a one way only deal. I want to do this with git-bundle. The problem seems to boil down to the fact that git-svn marks the svn repository as remotes. I had tried to check out a bundle using git bundle create ____.bundle --all...it works, but it only includes my master. It does NOT include the remotes refs. I need to get all of that information however.

Does this make sense? Any tips/suggestions? It should be made clear that we do NOT commit to the git repository on the SVN side, it will be read-only. On the offline side, we will branch the remote branches, and commit there.

Thanks!

Was it helpful?

Solution

Although git svn originally sets things up so that svn branches appear as remotes, that can be changed by altering the refspec used to create branches. But, this should be done before fetching anything from the svn repository.

git svn init --stdlayout http/svn.server/path svnclone
cd svnclone
edit .git/config

Then change the fetch and branches lines, and possibly the tags line to look like:

fetch = trunk:refs/heads/trunk
branches = branches/*:refs/heads/*
tags = tags/*:refs/tags/*

If the svn repository isn't using the standard layout, you can specify that as usual in the call to git svn init. In that case you'd want to leave the portions of the above lines before the colons as they are only altering the portions after the colon.

Once you have that setup you can use git svn fetch to actually copy the content. Since the branches go into the refs/heads namespace, git including the bundle command will treat them as local branches. As long as that clone is only being used as a source for other clones (either via bundle or just using the clone command) it shouldn't be a problem. Although if there's an svn branch named master or trunk that is likely to be an issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top