include/git: fetch submodules on one-tree projects

only fetch if .gitmodules exists

in some cases, lbmk is compiling source trees that
use submodules, without having downloaded them first.

in all cases, those submodules are either optional,
or the build system auto-fetches them (or if it can,
we sometimes disable it as with grub and gnulib).

this is a nice fallback behaviour, for situations where
we forget to put submodules as dependencies under
config/git (and disable submodules in the given project).

with this change, release archives are guaranteed to
be complete, sans crossgcc downloads in coreboot; this
will be handled in a follow-up commit.

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-10-20 07:50:47 +01:00
parent f855611c99
commit 54eb347a30
1 changed files with 5 additions and 0 deletions

View File

@ -113,6 +113,11 @@ git_reset_rev()
( (
cd "${1}" || err "git_reset_rev: !cd ${1}" cd "${1}" || err "git_reset_rev: !cd ${1}"
git reset --hard ${2} || err "!git reset ${1} <- ${2}" git reset --hard ${2} || err "!git reset ${1} <- ${2}"
if [ "${project}" != "coreboot" ] && [ "${project}" != "u-boot" ] && \
[ -f ".gitmodules" ]; then
git submodule update --init --checkout || \
err "git_reset_rev ${1}: can't download submodules"
fi
) )
} }