Is it possible for a git submodule to be made of several other git submodules, and the super git repo to fetch the contents for each submodule?
The author assumed a git submodule hierarchy like this:
- repo1
- submodule xyz1
- submodule xyz2
- repo2
- submodule repo1
This question is about the possibility of nesting a submodule within a submodule:
- repo1
- submodule a
- submodule ab
- submodule ac
- submodule a
Real example of a .gitmodules should look like this:
[submodule "Source/V8"]
path = Source/V8
url = https://chromium.googlesource.com/v8/v8.git
[submodule "Source/V8/build/gyp"]
path = Source/V8/build/gyp
url = https://chromium.googlesource.com/external/gyp
[submodule "Source/V8/third_party/cygwin"]
path = Source/V8/third_party/cygwin
url = https://chromium.googlesource.com/chromium/deps/cygwin
[submodule "Source/V8/third_party/python_26"]
path = Source/V8/third_party/python_26
url = https://chromium.googlesource.com/chromium/deps/python_26
[submodule "Source/V8/third_party/icu"]
path = Source/V8/third_party/icu
url = https://chromium.googlesource.com/chromium/deps/icu52
[submodule "Source/V8/testing/gtest"]
path = Source/V8/testing/gtest
url = https://chromium.googlesource.com/chromium/testing/gtest
[submodule "Source/V8/testing/gmock"]
path = Source/V8/testing/gmock
url = https://chromium.googlesource.com/chromium/testing/gtest
Note that the path of the submodules are nested:
- Source/V8
- Source/V8/build/gyp
- Source/V8/third_party/cygwin
I tried the following example with no success:
git submodule add https://chromium.googlesource.com/v8/v8.git
Source/V8
git submodule add https://chromium.googlesource.com/external/gyp
Source/V8/build/gyp
results in:
The following path is ignored by one of your .gitignore files:
Source/V8/build/gyp
Use -f if you really want to add it.
using git submodule add -f results in:
Cloning into 'Source/V8/build/gyp'...
remote: Sending approximately 10.28 MiB ...
remote: Total 16486 (delta 10444), reused 16486 (delta 10444)
Receiving objects: 100% (16486/16486), 10.28 MiB | 2.07 MiB/s, done.
Resolving deltas: 100% (10452/10452), done.
Checking connectivity... done.
fatal: Pathspec 'Source/V8/build/gyp' is in submodule 'Source/V8'
Failed to add submodule 'Source/V8/build/gyp'
Please let me now if this case is possible to achieve.
Update: Note this question is about creating a submodule structure, not initializing it.