1

I am trying to set up subgit for a huge SVN repository. This repository is very old, so to tidy up the structure a little, I want to make seperate git-repositories for various subdirectories.

Suppose the SVN is at /svn and has the subdirectories project1, project2, etc.

This works

$ subgit configure --svn-url file:///svn/ git.git
$ subgit install git.git

This also works, but creates an empty repository

$ subgit configure --svn-url file:///svn/project1/ /tmp/project1.git
$ subgit install /tmp/project1.git
[...]
Translating Subversion revisions to Git commits...

    Subversion revisions translated: 6563.
    Total time: 1 seconds.

INSTALLATION SUCCESSFUL
[...]
$ git clone /tmp/project1.git
Cloning into 'project1'...
warning: You appear to have cloned an empty repository.
done.

In the SVN there are actually files inside project1. Why doesn't it work with subgit and how can I fix it?

cforbish
  • 8,567
  • 3
  • 28
  • 32
Henri Menke
  • 10,705
  • 1
  • 24
  • 42

1 Answers1

2

Note that after running subgit configure and before running subgit install you have to adjust config file at $GIT_REPO/subgit/config. By default SubGit generates the following options there:

[svn]
  url = file:///svn/project1
  trunk = trunk:refs/heads/master
  branches = branches/*:refs/heads/*
  tags = tags/*:refs/tags/*
  shelves = shelves/*:refs/shelves/*

I suppose your Subversion repository has some non-standard layout; in this case you have to specify branches and tags options correctly, so SubGit can detect and convert them properly.

It would help me if you could list children of file:///svn/project1 directory and describe how branches and tags were created and merged in this repository.

E.g. if there is only one single branch for the whole project and this branch is file:///svn/project1, then you can use the following options:

[svn]
  url = file:///svn/
  trunk = project1:refs/heads/master
  branches = branches/project1/*:refs/heads/*
  tags = tags/project1/*:refs/tags/*
  shelves = shelves/project1/*:refs/shelves/*

Please find more information on configuration and installation stages in SubGit Book.

Hope that helps.

vadishev
  • 2,979
  • 20
  • 28
  • +1: Thank you very much for your detailed answer. Unfortunately I'm not very familiar with SVN (that's why I want to convert it to git) so I have get into more detail regarding the branching stuff. But my first try worked so far thanks to your help. – Henri Menke Dec 09 '13 at 10:57
  • My case is similar and I was nervous about giving tags and branches paths that do not exist, but it seems to have worked just fine and it has not (yet) created a branches or tags directory. Thanks! – sage Jul 31 '16 at 23:15
  • @vadishev what do I do if the svn repo does not have any branches or tags or anything and everything was just committed to "master" ? – Pavel Oct 15 '19 at 15:07