diff --git a/cdist/conf/type/__git/explorer/needs-update b/cdist/conf/type/__git/explorer/needs-update index 2c316683..1b05b536 100755 --- a/cdist/conf/type/__git/explorer/needs-update +++ b/cdist/conf/type/__git/explorer/needs-update @@ -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")" diff --git a/cdist/conf/type/__git/gencode-remote b/cdist/conf/type/__git/gencode-remote index 370b966e..48fa8e58 100755 --- a/cdist/conf/type/__git/gencode-remote +++ b/cdist/conf/type/__git/gencode-remote @@ -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\"" diff --git a/cdist/conf/type/__git/man.rst b/cdist/conf/type/__git/man.rst index 2db4d548..8540a4b4 100644 --- a/cdist/conf/type/__git/man.rst +++ b/cdist/conf/type/__git/man.rst @@ -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. diff --git a/cdist/conf/type/__git/parameter/boolean b/cdist/conf/type/__git/parameter/boolean index 187f71c0..ddca1268 100644 --- a/cdist/conf/type/__git/parameter/boolean +++ b/cdist/conf/type/__git/parameter/boolean @@ -1,3 +1,4 @@ mode-recursive +no-updates recursive shallow