From 54eb347a300c45f8c6c846ed96398c29a0db52a2 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 20 Oct 2023 07:50:47 +0100 Subject: 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 --- include/git.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/git.sh b/include/git.sh index 5c3ee81e..2976ff33 100755 --- a/include/git.sh +++ b/include/git.sh @@ -113,6 +113,11 @@ git_reset_rev() ( cd "${1}" || err "git_reset_rev: !cd ${1}" 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 ) } -- cgit v1.2.1