summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo
diff options
context:
space:
mode:
authorFelipe Reyes <freyes@tty.cl>2014-01-02 18:13:40 -0300
committerFelipe Reyes <freyes@tty.cl>2014-01-07 16:03:29 -0300
commit0ea16bba47cf177dc17fa14f20d54d0091a09865 (patch)
treef411e569543eadd3f4695a7aa474b47678f649eb /lib/puppet/provider/vcsrepo
parente4eb8ab551d41c6d4d96cc3d0c4bc3186d4ed74d (diff)
downloadpuppet-vcsrepo-0ea16bba47cf177dc17fa14f20d54d0091a09865.tar.gz
puppet-vcsrepo-0ea16bba47cf177dc17fa14f20d54d0091a09865.tar.bz2
Add the option to shallow clones with git
The new parameter used to indicate that you want a shallow clone is `:depth`
Diffstat (limited to 'lib/puppet/provider/vcsrepo')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index d488271..af38a59 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -6,7 +6,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
##TODO modify the commands below so that the su - is included
optional_commands :git => 'git',
:su => 'su'
- has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user
+ has_features :bare_repositories, :reference_tracking, :ssh_identity, :multiple_remotes, :user, :depth
def create
if !@resource.value(:source)
@@ -131,6 +131,9 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
def clone_repository(source, path)
check_force
args = ['clone']
+ if @resource.value(:depth) and @resource.value(:depth).to_i > 0
+ args.push('--depth', @resource.value(:depth).to_s)
+ end
if @resource.value(:ensure) == :bare
args << '--bare'
end