Peter Gerdes
Peter Gerdes

Reputation: 2988

Can git svn init handle sibling directories of trunk/branches/tags that should be part of base checkout

The macports svn repository looks like this:

  branches/
  contrib/
  distfiles/
  downloads/
  tags/
  trunk/
  users/

I want to import this using git svn and use the standard features to correctly interpret the branches and tags.

What I would like to see is a single git repo that has directories

  trunk/ 
  contrib/
  distfiles/
  downloads/
  users/

In other words I want to retain the branches in the branches directory as branches (for trunk I presume) and the tags as git tags. However, I want to be able to see both the contents of trunk, contrib, distfiles, downloads and users without switching branches.

This is similar to this question however it differs in that these extra directories (contrib, distfiles, downloads, users) don't have their own tags or branches. Seems to me they should be subdirectories of trunk so an alternative solution would be to somehow check out trunk with these extra subdirectories appearing under trunk. However, it may be impossible for the reason.

If not any suggestion how to easily deal with this so I can easily browse contrib and trunk at the same time without doing anything really difficult? I could jury rig it with submodules but that seems to be asking for trouble.

Upvotes: 3

Views: 318

Answers (1)

Peter Bratton
Peter Bratton

Reputation: 6408

Sure:

git svn clone http://repo_hostname/top_level_dir_above_those

Without any options, git svn won't look for branches, and just check the whole thing out like you want.

UPDATE:

Following further clarification, there isn't a way for some parts of a git repository to be viewable across all branches at the same revision... git versions the entire directory tree structure.

You can use the above command, however, to checkout each of those top level directories into its own repository, and then use a standard-layout git svn repo for your branches, tags, and trunk. Keeping them up to date will be a pain, but a shell script can execute a fetch for each repo as a convenience.

Upvotes: 2

Related Questions