1

I am trying to import a svn repository that follows the standard svn convention (trunk/branches/tags). The "problem" is that below each copy there are two totally useless directories that I'd really like to eliminate in my git repo. My svn structure looks like this:

trunk/redundantdir1/redunddantdir2/realstuff
branches/b1/redundantdir1/redunddantdir2/realstuff
tags/t1/redundantdir1/redunddantdir2/realstuff
...

In svn those two directories didn't hurt as much, because most users would just check out from "realstuff" and down. With git I'd really like to keep redundant-dirs out of the repo. I'm not prepared to start changing the svn structure, and I need to be able to keep the git repo in synch with subversion for (a short) time. Suggestions ?

krosenvold
  • 75,535
  • 32
  • 152
  • 208

2 Answers2

1

I don't suggest using git-svn to do any SVN branching or merging, so you really don't need the branches or tags directories. Then you can just clone the part of the repo you need like this:

git-svn clone https://example.com/svnroot/trunk/redundantdir1/redunddantdir2/realstuff myprojectname

Edit: If you do need to make changes in a branch (rather than creating or merging branches which I would suggest doing with real svn), then you can simply clone that branch as a separate git repo like so:

git-svn clone https://example.com/svnroot/branches/b1/redundantdir1/redunddantdir2/realstuff myprojectname-b1
Andy Balaam
  • 6,423
  • 6
  • 34
  • 37
  • Actually a good suggestion which may fit the bill as long as I always merge changes back to trunk in svn and fetch them into git from there. But there is at least one branch in svn that I need to get into this git repo. – krosenvold Aug 13 '09 at 13:30
  • I'd suggest using a different git repo to make changes in that branch. – Andy Balaam Aug 13 '09 at 14:28
0

My answer to this question might also be useful.

Basically, the idea is to seperate out the git svn clone into two operations, first a git svn init to set up the repository with exclusions, then a git svn fetch to pull in the revisions from svn:

git svn init <Svn repo url> -s --ignore-paths 'redundantdir1'
git svn fetch

This also give you the option for your git repo to be a narrow clone of the svn repo, for instance to ignore the first 12344 changesets in the svn repo you can do:

git svn fetch -r 12345:HEAD

From then on, git svn fetch will just fest more recent changesets.

Community
  • 1
  • 1
Mark Booth
  • 7,605
  • 2
  • 68
  • 92