[__git] Add a --no-updates flag to support old static behaviour.

Users relying on this would probably be better off using tags, but this enables
old behaviour with minor changes in existing manifests.
This commit is contained in:
evilham 2020-06-18 11:28:20 +02:00
parent 6e3ef60f89
commit e23e5ffa3c
4 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,10 @@
#!/bin/sh -e
if [ -f "$__object/parameter/no-updates" ]; then
# User requested explicitly not to have updates
exit
fi
destination="/$__object_id"
state_should="$(cat "$__object/parameter/state")"

View File

@ -25,6 +25,10 @@ owner_is=$(cat "$__object/explorer/owner")
group_is=$(cat "$__object/explorer/group")
needs_update=$(cat "$__object/explorer/needs-update")
if [ -f "$__object/parameter/no-updates" ]; then
no_updates="YES"
fi
state_should=$(cat "$__object/parameter/state")
branch_should=$(cat "$__object/parameter/branch")
@ -78,7 +82,7 @@ EOF
echo "su -m '$git_user' -c \"git checkout '$branch_should'\""
echo "change $branch_is -> $branch_should" >> "$__messages_out"
repo_changed="YES"
elif [ "$needs_update" = "YES" ]; then
elif [ -z "$no_updates" ] && [ "$needs_update" = "YES" ]; then
# The remote has newer information than our repository.
# Fetch was done in the explorer, here we can just pull
echo "su -m '$git_user' -c \"git -C '$destination' pull\""

View File

@ -47,6 +47,12 @@ mode-recursive
If present and --mode is passed, the given permissions will be applied
recursively to the working directory.
no-updates
If present the repository will not be updated after first check out.
Notice that this does not affect behaviour if you change the target
tag / branch, in which case the type will still ensure the specified one
is checked out.
recursive
Passes the --recurse-submodules flag to git when cloning the repository.

View File

@ -1,3 +1,4 @@
mode-recursive
no-updates
recursive
shallow