I'm using a few git submodules in my project, each with their own dependencies. I'm running the top level setup.sh
, which installs top level deps and then runs this, which calls each submodule's setup.sh
script.
git submodule foreach 'if [ -e "setup.sh" ]; then ${SUDO} "`pwd`/setup.sh"; fi'
That runs fine, but the problem arises when the sub1
and sub2
submodules call their own setup.sh
script that does the exact same thing.
When any git command is run by the sub1
and sub2
setup.sh
script, it fails with the error:
fatal: not a git repository: '.git'
pwd
in the sub1
and sub2
scripts give me the correct path, and the scripts work fine in isolation.
Project structure:
.
├── setup.sh
└── submodules
├── sub1
| ├── setup.sh
| └── submodules
| └── sub3
| └── setup.sh
└── sub2
├── setup.sh
└── submodules
└── sub4
└── setup.sh
Apologies if this is a stupid question, thanks a bunch.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…