Add --shallow option
Provides the capability to make shallow clones (including submodules) to deploy repositories with huge history. Note that this might not work with some servers (github.com) if the commit that is required by a submodule is too far away from any reference.
This commit is contained in:
parent
0c7d98e89e
commit
2abc34f922
3 changed files with 7 additions and 1 deletions
|
@ -36,6 +36,7 @@ group=$(cat "$__object/parameter/group")
|
||||||
mode=$(cat "$__object/parameter/mode")
|
mode=$(cat "$__object/parameter/mode")
|
||||||
|
|
||||||
[ -f "$__object/parameter/recursive" ] && recursive='--recurse-submodules' || recursive=''
|
[ -f "$__object/parameter/recursive" ] && recursive='--recurse-submodules' || recursive=''
|
||||||
|
[ -f "$__object/parameter/shallow" ] && shallow='--depth 1 --shallow-submodules' || shallow=''
|
||||||
|
|
||||||
[ "$state_should" = "$state_is" ] \
|
[ "$state_should" = "$state_is" ] \
|
||||||
&& [ "$owner" = "$owner_is" ] \
|
&& [ "$owner" = "$owner_is" ] \
|
||||||
|
@ -45,7 +46,7 @@ mode=$(cat "$__object/parameter/mode")
|
||||||
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 "$recursive" --branch "$branch" "$source" "$destination"
|
echo git clone --quiet "$recursive" "$shallow" --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
|
||||||
|
|
|
@ -38,6 +38,10 @@ owner
|
||||||
recursive
|
recursive
|
||||||
Passes the --recurse-submodules flag to git when cloning the repository.
|
Passes the --recurse-submodules flag to git when cloning the repository.
|
||||||
|
|
||||||
|
shallow
|
||||||
|
Sets --depth=1 and --shallow-submodules for cloning repositories with big history.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
recursive
|
recursive
|
||||||
|
shallow
|
||||||
|
|
Loading…
Reference in a new issue