Question

My project uses svn and I went git along time ago. I've been using git-svn for quite a while with a lot of success. But now at a new employeer, I'm having some problems.

The layout in SVN is:

http://path/to 
             /trunk/
                     submodule1
                     submodule2

             /branches/
                       branch1
                                   submodule1
                       branch2 
                                   submodule1
                                   submodule2

I checked-out my git-svn to track each submodule (which I think is the right way to go).

          git svn clone http://path/to/trunk/submodule1 
          git svn clone http://path/to/trunk/submodule2

Which gives me trunk, but I can't figure out how to track each branch. I want to think that --prefix would help me, I don't think that it will.

Anyone have ideas?

Was it helpful?

Solution

You should be able to achieve this using wildcards in your layout specification. I.e. for submodule1 you would do

git svn clone --trunk=trunk/submodule1 
              --branches=branches/*/submodule1 \
              --tags=tags/*/submodule1 \
        http://path/to

(assuming you also had tags following the same pattern). Repeat the same for the other submodules.

The --prefix option has nothing to do with this. It just controls how the branches will be named in the resultin git repository. Without the option, all branches will go straight under refs/remotes/. If you'd like something more like the usual remote branch layout, you can use e.g.

git svn clone --prefix=svn/ ...

to get refs/remotes/svn/trunk, refs/remotes/svn/branch1 etc. The value is prepended verbatim to the resulting branch names, so you need the trailing / or you'll end up with something like refs/remotes/svntrunk

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