fix fetch-submodules.sh for older git

This commit is contained in:
Dan Halbert 2023-06-06 21:38:56 -04:00
parent e631350b9b
commit 561caae35c
1 changed files with 3 additions and 4 deletions

View File

@ -16,9 +16,8 @@ done
echo ${abs_submodules}
# Fetch submodules as partial clones if possible. If that fails due to an older version of git,
# do a shallow init with no fetch and then check out the proper commit.
# do a shallow init and fetch tags.
git submodule update --init --filter=blob:none ${abs_submodules} || \
git submodule update --init --no-fetch --depth 1 ${abs_submodules} || \
git submodule foreach $* \
'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1' || \
git submodule update --init --depth 1 ${abs_submodules} && \
git submodule foreach 'git fetch --tags --depth 1' || \
echo "ERROR: fetch-submodules.sh FAILED"