gitsvngit-svngit-clone

Missing branches cloning a non-standard svn repository using git-svn clone


I am a complete git newbie and I want to clone my svn repository using git-svn. However, the branches are missing after the clone command is run.

The repo layout is as follows:

trunk/
branches/team/releases/release-1
branches/team/releases/release-2
...
branches/development/user1/feature1
branches/development/user1/feature2
branches/development/user2/feature3
branches/development/user2/feature4
...
tags/release1
tags/release2

The command I'm using is:

git svn clone --trunk=/trunk --branches=branches/*/* --tags=tags/*/* --prefix=svn/ --authors-file=authors.txt <my-repo> <git-repo-name>

I've tried modifying the branches option to /branches/development/user1/* and /branches/development/user1/*/* (and also using both together) and running the clone command again to see if any additional branches are picked up but they're not.

Is it OK to run clone again or to I have to start from scratch and delete the git repo?

All I can see if I run git branch -r after cloning is:

svn/development/user1
svn/development/user1
svn/team/releases
svn/trunk
note that all the tags are present but omitted for brevity

How do I get the missing branches?

This is not a duplicate of Cloning a Non-Standard Svn Repository with Git-Svn or how to use nested branches through git-svn.


Solution

  • You can specify the --branches tag more than once. From the docs:

    These are optional command-line options for init. Each of these flags can point to a relative repository path (--tags=project/tags) or a full url (--tags=https://foo.org/project/tags). You can specify more than one --tags and/or --branches options, in case your Subversion repository places tags or branches under multiple paths. The option --stdlayout is a shorthand way of setting trunk,tags,branches as the relative paths, which is the Subversion default. If any of the other options are given as well, they take precedence.

    In your case, try:

    git svn clone \
      --branches=branches/team/releases/* \
      --branches=branches/development/user1/* \
      --branches=branches/development/user2/* \
    

    ...etc.

    Is it OK to run clone again or to I have to start from scratch and delete the git repo?

    Generally speaking you ought to try from scratch. The tool is not meant to be an update script.