From 14f078077532025e11024446b80798eeabeba7a7 Mon Sep 17 00:00:00 2001 From: Evilham Date: Wed, 17 Jun 2020 22:28:07 +0200 Subject: [PATCH] [__git]: Change default behaviour for --mode parameter By default it only applies to the top-level directory, that way any permissions that are specified in git are respected after cloning. Old behaviour can be obtained with the new `--mode-recursive` parameter. Closes #818. --- cdist/conf/type/__git/gencode-remote | 5 ++++- cdist/conf/type/__git/man.rst | 8 ++++++++ cdist/conf/type/__git/parameter/boolean | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cdist/conf/type/__git/gencode-remote b/cdist/conf/type/__git/gencode-remote index ab22655f..11bd0a00 100755 --- a/cdist/conf/type/__git/gencode-remote +++ b/cdist/conf/type/__git/gencode-remote @@ -52,8 +52,11 @@ case $state_should in { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then echo chown -R "${owner}:${group}" "$destination" fi + if [ -f "$__object/parameter/mode-recursive" ]; then + mode_recursive="-R" + fi if [ -n "$mode" ]; then - echo chmod -R "$mode" "$destination" + echo chmod "${mode_recursive}" "$mode" "$destination" fi ;; diff --git a/cdist/conf/type/__git/man.rst b/cdist/conf/type/__git/man.rst index d3e15f25..4416db58 100644 --- a/cdist/conf/type/__git/man.rst +++ b/cdist/conf/type/__git/man.rst @@ -31,10 +31,18 @@ group mode Unix permissions, suitable for chmod. + By default it only applies to the top-level directory. + See the mode-recursive parameter as well. owner User to chown to. +BOOLEAN PARAMETERS +------------------ +mode-recursive + If present and --mode is passed, the given permissions will be applied + recursively to the working directory. + 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 d600d4ca..187f71c0 100644 --- a/cdist/conf/type/__git/parameter/boolean +++ b/cdist/conf/type/__git/parameter/boolean @@ -1,2 +1,3 @@ +mode-recursive recursive shallow