Skip to content
Snippets Groups Projects
Commit 36b2b5a9 authored by Karel Koci's avatar Karel Koci :metal: Committed by Josef Schlehofer
Browse files

helpers/generate_common.sh: protect against remote HEAD change

parent 959e13e1
Branches
Tags
2 merge requests!569Turris OS 6.0 (HBK),!444helpers/generate_common.sh: protect against remote HEAD change
Pipeline #104465 passed with stages
in 8 minutes and 36 seconds
......@@ -182,7 +182,14 @@ git_mirror_update() {
_git_mirror_lock "$SHELL" -eus "$mirror" "$url" <<-"EOF"
git -C "$1" remote set-url origin "$2"
git -C "$1" remote update --prune
[ "$(git -C "$1" rev-parse HEAD)" = "$(git -C "$1" rev-parse FETCH_HEAD)" ] \
|| rm -rf "$1"
EOF
if [ ! -d "$mirror" ]; then
note "Remote head changed. Local mirror removed for re-clone."
git_mirror_update "$@"
return
fi
else
_git_mirror_lock \
git -C "$GIT_MIRROR" clone --mirror "$url" "$mirror"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment