1

I have an existing SVN repository, which has a "common" directory containing modules shared by different projects. The layout is like this:

http://example.com/svn/trunk/common/module_1
http://example.com/svn/trunk/common/module_2
...
http://example.com/svn/trunk/common/module_X

For various reasons, I'm managing some other projects with git. I need to use module_X in both SVN and git projects, so I'm planning to use git-svn. However, the following problem occurs:

user@host:/repos$ git svn clone http://example.com/svn/trunk/common/module_X destination

This command will create a new git repository in /repos/destination and fetches module_X content into it. What I need to accomplish is to put module_X in in /repos/destination/module_X, not to fetch it's content directly into /repos/destination/.

What seemed an option in the beginning was to use

user@host:/repos$ git svn clone =--ignore-paths='^((?!module_X).*)$' http://example.com/svn/trunk/common/ destination

which will make a repository in /repos/destination, and a subdirectory /repos/destination/module_X. But the problem is that my SVN repository has a rather large revision history and opreations on the whole common/ path are rather slow.

Does anyone have idea how to accomplish this?

Guss
  • 30,470
  • 17
  • 104
  • 128
Alexander
  • 83
  • 1
  • 4

1 Answers1

0

short answer : you can't, or you don't want. Git has not been designed to host multiple projects, and thus clone independant subdirectories, one git == one project. Even though you can do it (look at the very insightful answer of : How do I clone a subdirectory only of a Git repository?), you will loose all ability to keep uptodate with the updates.

There may be one hack though you could try, is to tell git-svn to create a branch for each module you have, here you have a good example : Cloning a Non-Standard Svn Repository with Git-Svn, something that should look like:

% git svn clone https://svn.myrepos.com/myproject myproject --ignore-paths='^((?!common).*)$' --trunk=trunk/ --branches=trunk/common/* --prefix=svn/

(untested)

Community
  • 1
  • 1
zmo
  • 24,463
  • 4
  • 54
  • 90