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:
parent
e3de822f48
commit
cabc1cac08
|
@ -51,12 +51,17 @@ sync_repo()
|
||||||
git -C "${dst_path}" checkout "${src_revision}"
|
git -C "${dst_path}" checkout "${src_revision}"
|
||||||
fi
|
fi
|
||||||
elif [ -z "${src_path}" ] ; then
|
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 get-url origin || \
|
||||||
git -C "${dst_path}" remote add origin "${src_uri}"
|
git -C "${dst_path}" remote add origin "${src_uri}"
|
||||||
git -C "${dst_path}" remote set-url origin "${src_uri}"
|
git -C "${dst_path}" remote set-url origin "${src_uri}"
|
||||||
git -C "${dst_path}" clean -dfx
|
git -C "${dst_path}" clean -dfx
|
||||||
|
|
||||||
|
if [ "${localrev}" != "${src_revision}" ] ; then
|
||||||
git -C "${dst_path}" fetch origin
|
git -C "${dst_path}" fetch origin
|
||||||
git -C "${dst_path}" checkout "${src_revision}"
|
git -C "${dst_path}" checkout "${src_revision}"
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
rm -rf "${dst_path}"
|
rm -rf "${dst_path}"
|
||||||
|
|
Loading…
Reference in New Issue