Re: [RFC] What to you think about a loose status for submodules?
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:35
Heiko Voigt [off-list ref] writes:
For such a workflow I would like to implement what I call 'loose' submodules. Where a git clone project.git cd project git submodule init && git submodule update would omit the 'help' folder. But in case I specify it directly like
I thought a blanket "submodule init/update" wasn't even a recommended practice for this exact reason. We tried to keep the default not to gratuitously populate and checkout all submodule repositories, but probably what you are trying to do was made more difficult by mistake because people who wanted the other behaviour pushed too hard? Defaulting to "do not populate and checkout unless explicitly asked" sounds like the right thing to do, and if we broke it, it should be corrected, I think. Shouldn't it be a simple matter of teaching "--all" option to "submodule init" (and "update") to let them blindly affect all submodules, while making the default not to do anything?
git submodule init help it would update to the recorded revision. Of course the relation would be configurable. E.g.: git config submodule."name".relation loose and the opposite as git config submodule."name".relation tight
I do not think this should be a project-wide configuration that is
recorded in .gitmodules; if you are "help documentation" participant to
the project you would want "help" submodule, and other people will want
different submodules.
It would probably make more sense to introduce the notion of "module
groups", similar to the way "remote update <group>" can name a group of
remotes to affect. Then documentation people can say
submodule init doc && submodule update
if .gitmodules file records the mapping from "doc" to one or more
submodules (e.g. "help" and "doc"). If we are going to take this route,
it would still make sense to teach "--all" to "submodule init" and perhaps
default to init the "default" group if one exists, instead of making the
parameterless "init" a no-op as I suggested earlier.
But it is quite a long time since I looked at git-submodule.sh so please
take the above with a healthy dose of salt.