Merge branch 'git-recursive' into 'master'

__git type: Add --recursive option

See merge request ungleich-public/cdist!794
This commit is contained in:
poljakowski 2019-10-01 06:25:31 +02:00
commit 9d26fbdfb8
3 changed files with 19 additions and 16 deletions

View file

@ -19,32 +19,31 @@
# #
# #
state_is="$(cat "$__object/explorer/state")" state_is=$(cat "$__object/explorer/state")
owner_is="$(cat "$__object/explorer/owner")" owner_is=$(cat "$__object/explorer/owner")
group_is="$(cat "$__object/explorer/group")" group_is=$(cat "$__object/explorer/group")
state_should="$(cat "$__object/parameter/state")" state_should=$(cat "$__object/parameter/state")
branch="$(cat "$__object/parameter/branch")" branch=$(cat "$__object/parameter/branch")
source="$(cat "$__object/parameter/source")" source=$(cat "$__object/parameter/source")
destination="/$__object_id" destination="/$__object_id"
owner="$(cat "$__object/parameter/owner")" owner=$(cat "$__object/parameter/owner")
group="$(cat "$__object/parameter/group")" group=$(cat "$__object/parameter/group")
mode="$(cat "$__object/parameter/mode")" mode=$(cat "$__object/parameter/mode")
[ "$state_should" = "$state_is" ] && \ [ "$state_should" = "$state_is" ] \
[ "$owner" = "$owner_is" ] && \ && [ "$owner" = "$owner_is" ] \
[ "$group" = "$group_is" ] && \ && [ "$group" = "$group_is" ] \
[ -n "$mode" ] && exit 0 && [ -n "$mode" ] && exit 0
case $state_should in case $state_should in
present) present)
if [ "$state_should" != "$state_is" ]; then if [ "$state_should" != "$state_is" ]; then
echo git clone --quiet --branch "$branch" "$source" "$destination" echo git clone --quiet $([ -f "$__object/parameter/recursive" ] && echo '--recursive') --branch "$branch" "$source" "$destination"
fi fi
if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \ if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \
{ [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then
@ -54,8 +53,9 @@ case $state_should in
echo chmod -R "$mode" "$destination" echo chmod -R "$mode" "$destination"
fi fi
;; ;;
# Handled in manifest
absent) absent)
# Handled in manifest
;; ;;
*) *)

View file

@ -35,6 +35,8 @@ mode
owner owner
User to chown to. User to chown to.
recursive
Passes the --recursive flag to git when cloning the repository.
EXAMPLES EXAMPLES
-------- --------

View file

@ -0,0 +1 @@
recursive