When updating submodules, always checkout even if the HEAD is the
desired commit hash (update --force) to avoid the following:
* a directory gmock exists in hammer
* a submodule gmock replaces the directory gmock in master
* checkout master + submodule update : gmock/.git is created
* checkout hammer : the gmock directory still contains the .git from
master because it did not exist at the time and checkout won't
remove untracked directories
* checkout master + submodule update : git rev-parse HEAD is
at the desired commit although the content of the gmock directory
is from hammer
Signed-off-by: Loic Dachary <ldachary@redhat.com>
fi
if test -d ".git" ; then
- if ! git submodule sync || ! git submodule update --init --recursive; then
+ if ! git submodule sync || ! git submodule update --force --init --recursive; then
echo "Error: could not initialize submodule projects"
echo " Network connectivity might be required."
exit 1
Checkout the submodules::
- git submodule update --init --recursive
+ git submodule update --force --init --recursive
4. Update Build version numbers
================================
If your submodules are out of date, run::
- git submodule update --init --recursive
+ git submodule update --force --init --recursive
Choose a Branch
===============
cd $downstream
git reset --hard $ref || return 1
git submodule sync --recursive || return 1
- git submodule update --init --recursive || return 1
+ git submodule update --force --init --recursive || return 1
)
}