Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[orion-dev] git submodule support

One weakness in git in my experience is combining two repositories.

Based on reading various blogs on git I've been using "fake git
submodules". This means cloning a sub-repo into your working directory
and checking the resulting files into your super-repo. As long as you
work on that filesystem, you can shift back and forth between the
super and sub repo by selecting your current directory.

If you (or others) clone the super repo, there is no way to easily
know or care about the submodule. This can be a plus.

In working on the Nonymous plugin I began to understand why the 'fake
git submodule' solution isn't great. I forked Mark's outliner repo and
created a fake submodule under lib/nonymous. The good news is that my
fake submodule under nonymous/UglifyJS just came in nicely.  When I
edited files under outliner/lib/Nonymous in Orion I could commit them
no problem.

But these commits are unknown to my Nonymous repo. In my mind I had
branched Nonymous to work on Outliner, but git knows nothing about
this.

Of course I got the source changes. I just went back to the local
drive where I created the fake submodule, merged my Outliner remote,
cd to the lib/nonymous, and committed/push the changes back to
Nonymous. But this lost all of my commit comments (ok maybe that's
good ;-) and I will admit that the actual process was not so much
"just went back" as "dang where am I now?".

Surely there ought to be a better solution. At the point where I
grafted the subrepo on to the super repo I should have recorded the
subrepo HEAD ref then did some sort of git magic to merge the changes
made on the subrepo-part-of-the-superrepo back on to the original
subrepo.

As far as I can tell, that is more or less what git submodule does.
But its widely dis-respected because it has some major flaws, among
them:
  1) cloners of the super-repo have to explicitly issue two commands
get the sub-repos.
  2) the name of sub-repo  in the super-repo is the directory name
without the slash, meaning that shell completion on the name will give
exactly the wrong answer:
      git add myLo<tab> ==> git add myLongSubRepo/ ==> you just added
the wrong thing.

And (finally!) the punch line: these are UI flaws so Orion could
provide git submodule support avoiding these problems and the problems
with fake submodules.

jjb


Back to the top