Honor GIT_SUBMODULES_ARE_EVIL

This commit is contained in:
David Sidrane 2016-12-12 13:58:56 -10:00 committed by Lorenz Meier
parent 16229b3985
commit 318c69c74b

View File

@ -1,14 +1,5 @@
#!/usr/bin/env bash
[ -n "$GIT_SUBMODULES_ARE_EVIL" ] && {
# GIT_SUBMODULES_ARE_EVIL is set, meaning user doesn't want submodules
echo "Skipping submodules. NUTTX_SRC is set to $NUTTX_SRC"
exit 0
}
GITSTATUS=$(git status)
function check_git_submodule {
# The .git exists in a submodule if init and update have been done.
@ -62,6 +53,27 @@ fi
}
# If called with a path then respect $GIT_SUBMODULES_ARE_EVIL but do normal processing
if [ "$#" != "0" ];
then
# called with a path then process only that path but respect $GIT_SUBMODULES_ARE_EVIL
[ -n "$GIT_SUBMODULES_ARE_EVIL" ] && {
# GIT_SUBMODULES_ARE_EVIL is set, meaning user doesn't want submodules updated
echo "GIT_SUBMODULES_ARE_EVIL is defined - Skipping submodules $1 update."
exit 0
}
git submodule update --recursive $1
else
[ -n "$GIT_SUBMODULES_ARE_EVIL" ] && {
# GIT_SUBMODULES_ARE_EVIL is set, meaning user doesn't want submodules updated
echo "GIT_SUBMODULES_ARE_EVIL is defined - Skipping All submodule checking!"
exit 0
}
check_git_submodule NuttX
check_git_submodule Tools/gencpp
check_git_submodule Tools/genmsg
@ -78,6 +90,5 @@ check_git_submodule src/lib/matrix
check_git_submodule src/modules/uavcan/libuavcan
check_git_submodule unittests/googletest
check_git_submodule src/drivers/gps/devices
fi
exit 0