diff --git a/cdist/conf/type/__git/gencode-remote b/cdist/conf/type/__git/gencode-remote index 11bd0a00..edc25aae 100755 --- a/cdist/conf/type/__git/gencode-remote +++ b/cdist/conf/type/__git/gencode-remote @@ -38,9 +38,13 @@ mode=$(cat "$__object/parameter/mode") [ -f "$__object/parameter/recursive" ] && recursive='--recurse-submodules' || recursive='' [ -f "$__object/parameter/shallow" ] && shallow='--depth 1 --shallow-submodules' || shallow='' +if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \ + { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then + needs_chown="YES" +fi + [ "$state_should" = "$state_is" ] \ - && [ "$owner" = "$owner_is" ] \ - && [ "$group" = "$group_is" ] \ + && [ -z "$needs_chown" ] \ && [ -n "$mode" ] && exit 0 case $state_should in @@ -48,8 +52,7 @@ case $state_should in if [ "$state_should" != "$state_is" ]; then echo git clone --quiet "$recursive" "$shallow" --branch "$branch" "$source" "$destination" fi - if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \ - { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then + if [ -n "$needs_chown" ]; then echo chown -R "${owner}:${group}" "$destination" fi if [ -f "$__object/parameter/mode-recursive" ]; then