Subject: Re: Migrating svn to git with heavy use of externals

From: "D. Stuart Freeman" <[email-masked]>
Date: Tue, 08 Apr 2008 16:49:59 -0400

Avery Pennarun wrote:
> On Tue, Apr 8, 2008 at 2:07 PM, D. Stuart Freeman
> <[email-masked]> wrote:
>> Maybe I should clarify.
>>  I've imported an svn managed project into a git repository
>>  with 71 submodules, what I don't understand though is if I
>>  have a branch called 2-5-x and another called 2-4-x in each of
>>  the submodules and the superproject, is there a way to
>>  associate those?
> 
> I don't think git-svn currently knows how to import svn:externals
> properly.  Basically you'd have to do it yourself, perhaps with the
> help of something like git-filter-branch and a shell script.
> 
> The equivalent of svn:externals in git is called git-submodule, and
> it's actually much more powerful than svn:externals, because you can
> link to a *specific revision* and not just a branch.  In other words,
> I can set up my application to point at r2956 of a library, so even if
> the library changes in the future, my application always gets exactly
> that version.  (To have the app use the later version, you have to
> 'git pull' in the submodule, then make a commit in the application
> module.)
> 
> See "man git-submodule" and "man git-filter-branch" for more information.
> 
> If I'm wrong and git-svn already supports svn:externals, I'm sure
> someone will correct me :)
> 
> Have fun,
> 
> Avery

It's possible to have svn:externals point at a specific revision, but
that's not the point.  I'm convinced that submodules are the answer, I'm
just not sure how to make them work. Assume "sakai" is the superproject
and "access" is a submodule, I've done:

cd sakai
git checkout work
git submodule add ../access access

And that's cool, but then I do:

cd ../access
git checkout -b 2-5-x sakai_2-5-x  # sakai_2-5-x is an svn import
cd ../sakai
git checkout -b 2-5-x sakai_2-5-x
git submodule add -b 2-5-x ../access access

Which gives me an error about access already existing.  I'm pretty sure
I'm just not thinking about this the way git does, I blame svn for
damaging my brain.

-- 
D. Stuart Freeman
Georgia Institute of Technology