diff options
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 3 | ||||
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/git_spec.rb | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 13e0793..4603029 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -125,6 +125,9 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) args = ['clone'] if @resource.value(:depth) and @resource.value(:depth).to_i > 0 args.push('--depth', @resource.value(:depth).to_s) + if @resource.value(:revision) + args.push('--branch', @resource.value(:revision).to_s) + end end if @resource.value(:ensure) == :bare args << '--bare' diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb index 116e357..29c6b3b 100644 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -60,7 +60,7 @@ branches resource[:depth] = 1 Dir.expects(:chdir).with('/').at_least_once.yields Dir.expects(:chdir).with('/tmp/test').at_least_once.yields - provider.expects(:git).with('clone', '--depth', '1', resource.value(:source), resource.value(:path)) + provider.expects(:git).with('clone', '--depth', '1', '--branch', resource.value(:revision),resource.value(:source), resource.value(:path)) provider.expects(:update_submodules) provider.expects(:git).with('branch', '-a').returns(branch_a_list(resource.value(:revision))) provider.expects(:git).with('checkout', '--force', resource.value(:revision)) |