git submodule init initialises submodules for which active=false has been defined
- From
- Timur Delahaye <timur.delahaye@corpowerocean.com>
- Date
- Mar 18, 2020, 12:50 UTC
- Message-ID
- <HE1PR04MB2987A255BC327320D1DDFE6692F70@HE1PR04MB2987.eurprd04.prod.outlook.com>
Hello,
I am trying to prevent git clone --recurse-submodules from installing some of the submodules of the repo that are not necessary to most users.
Here is what I did: In my main-project
git submodule add --name one url1 git submodule add --name two url2
Then I edited .gitmodules as follows
[submodule "one"] active = false url = url1 [submodule "two"] active = true url = url2
commited and pushed.
From a fresh folder when I run git clone --recurse-submodules main-repo-url both "one" and "two" get installed
Likewise if I do git clone main-repo-url git submodule init both "one" and "two" are installed and appear in .git/config as well as .git/modules/
From reading https://git-scm.com/docs/gitsubmodules/2.25.0 my understanding was that both procedures should have installed only "two" and that I should have needed to do git submodule init one in order to force the local installation of the inactive module "one".
Either I misunderstood the manual or there is a bug with git submodule init
I am using git version 2.17.1 on Ubuntu 18.04
If this is not a bug but an error on my side, I would really appreciate some explanation about the active=false flag so I can achieve my purpose.
Faithfully yours,
Timur