Add retries in git submodule update

This commit is contained in:
Alexey Milovidov 2024-05-20 06:13:06 +02:00
parent 6c51b771c5
commit 63f31d3c1e

View File

@ -160,10 +160,17 @@ function clone_submodules
git submodule sync
git submodule init
# --jobs does not work as fast as real parallel running
printf '%s\0' "${SUBMODULES_TO_UPDATE[@]}" | \
xargs --max-procs=100 --null --no-run-if-empty --max-args=1 \
git submodule update --depth 1 --single-branch
# Network is unreliable
for _ in {1..10}
do
# --jobs does not work as fast as real parallel running
printf '%s\0' "${SUBMODULES_TO_UPDATE[@]}" | \
xargs --max-procs=100 --null --no-run-if-empty --max-args=1 \
git submodule update --depth 1 --single-branch && break
sleep 1
done
git submodule foreach git reset --hard
git submodule foreach git checkout @ -f
git submodule foreach git clean -xfd