How to deal with partial svn:externals when migrating to Git?
Asked Answered
S

0

6

I would like to import a SVN repository into a GitHub Enterprise repository

There are many questions related to this matter and most of them can be addressed either with Git submodules or Git subtree.

In my case I have two repositories:

  • The main project repository
  • The modules repository (a big SVN repository over 2 GB)

This module repository has the following architecture:

foolib/
   moduleA/
      ...
   moduleB/
      ...
   ...

For the project, only few modules from foolib are used as svn:externals. For example this main project only uses moduleA from foolib.

As mentioned in this question one possible solution is to use sparse-checkout. I'm guessing Git subtree would also do the trick. Unfortunately it doesn't solve the main issue.

If my project is very small, as long as I get something from foolib, even with sparce-checkout, I will retrieve the whole history of foolib (e.g. 2 GB). This issue doesn't exist with SVN because an svn:externals property only fetches what it needs, not the whole history.

I can imagine to do foolish things like recreating a local sparse repository dynamically using the commits listed in git log --follow foolib/moduleA. But I assume this is not a good solution.

What would be the correct workflow to get a similar behavior in Git without having to fetch the whole history of foolib everything I need only few modules?

Sylvan answered 3/8, 2017 at 6:42 Comment(6)
"one possible solution": to which problem? Where is your git repo? Or are you using git-svn? I am still confused.Dispermous
@VonC, I've edited my question. The main issue there is with submodules, sparse-checkout or subtree I will always get the whole history of foolib which is huge. I would like to avoid this somehow.Sylvan
@Dispermous Any news?Sylvan
Could you consider help.github.com/articles/… in order to isolate each module in its own repo? (once foolib has been imported from SVN into one giant Git repo)Dispermous
This can help splitting the giant Git repo into smaller onesSylvan
Yes, that is the idea. That way, you can define a parent project with, as submodues, only the subrepos you need.Dispermous

© 2022 - 2024 — McMap. All rights reserved.