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

时光总嘲笑我的痴心妄想 提交于 2019-12-07 08:30:48

问题


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?

来源:https://stackoverflow.com/questions/45476709/how-to-deal-with-partial-svnexternals-when-migrating-to-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!