submodule code downloads full repository
davidklaftenegger opened this issue · 2 comments
When a submodule contains multiple branches (e.g. qd_library), the current CMake code downloads all branches instead of limiting itself to the tracked branch.
Is this something we can easily fix?
A possible solution might be the use of the following flag:
set-branch (-b|--branch) [--]
set-branch (-d|--default) [--]
Sets the default remote tracking branch for the submodule. The --branch option allows the remote branch to be specified. The --default option removes the submodule..branch configuration key, which causes the tracking branch to default to the remote HEAD.
git submodule update --init --default --recursive
appears to only download HEAD
, which I would assume is more desirable than downloading all branches. See below for a clean directory output.
-- Submodule update: submodules/qd
Submodule 'qd' (https://github.com/davidklaftenegger/qd_library.git) registered for path 'submodules/qd'
Cloning into '/home/sven/git/etascale-argodsm/submodules/qd'...
Submodule path 'submodules/qd': checked out '5348678b19fdde6d37a2559c1fe59bc44f25e8c2'
-- Submodule update: submodules/qd - Success
-- Submodule update: submodules/googletest
Submodule 'googletest' (https://github.com/google/googletest.git) registered for path 'submodules/googletest'
Cloning into '/home/sven/git/etascale-argodsm/submodules/googletest'...
Submodule path 'submodules/googletest': checked out '86add13493e5c881d7e4ba77fb91c1f57752b3a4'
-- Submodule update: submodules/googletest - Success
Actually, scratch that. I think it achieves the same thing, which is simply to check out HEAD
instead of the specified branch in .gitmodules
(which is currently equal to HEAD
). It appears that when git detects new or updated branches it will still pull these.