2
1
Fork 0
mirror of https://git.savannah.gnu.org/git/gnuboot.git synced 2025-01-27 09:40:20 +01:00

website-build: avoid unnecessary git fetch

When we already have the right untitled revision checked out, we don't
need to try to fetch its revision again. This also enable offline
builds in that case.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2023-11-17 10:14:35 +01:00 committed by Adrien 'neox' Bourmault
parent e3de822f48
commit cabc1cac08
Signed by: neox
GPG key ID: 2974E1D5F25DFCC8

View file

@ -51,12 +51,17 @@ sync_repo()
git -C "${dst_path}" checkout "${src_revision}"
fi
elif [ -z "${src_path}" ] ; then
localrev="$(git --no-pager log --oneline HEAD -1 --format='%H')"
git -C "${dst_path}" remote get-url origin || \
git -C "${dst_path}" remote add origin "${src_uri}"
git -C "${dst_path}" remote set-url origin "${src_uri}"
git -C "${dst_path}" clean -dfx
git -C "${dst_path}" fetch origin
git -C "${dst_path}" checkout "${src_revision}"
if [ "${localrev}" != "${src_revision}" ] ; then
git -C "${dst_path}" fetch origin
git -C "${dst_path}" checkout "${src_revision}"
fi
else
rm -rf "${dst_path}"