diff options
author | Felipe Reyes <freyes@tty.cl> | 2014-01-02 18:13:40 -0300 |
---|---|---|
committer | Felipe Reyes <freyes@tty.cl> | 2014-01-07 16:03:29 -0300 |
commit | 0ea16bba47cf177dc17fa14f20d54d0091a09865 (patch) | |
tree | f411e569543eadd3f4695a7aa474b47678f649eb /spec/unit/puppet/provider/vcsrepo | |
parent | e4eb8ab551d41c6d4d96cc3d0c4bc3186d4ed74d (diff) | |
download | puppet-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 'spec/unit/puppet/provider/vcsrepo')
-rw-r--r-- | spec/unit/puppet/provider/vcsrepo/git_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb index 554645b..c40388f 100644 --- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb +++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb @@ -31,6 +31,20 @@ describe Puppet::Type.type(:vcsrepo).provider(:git_provider) do end end + context "with shallow clone enable" do + it "should execute 'git clone --depth 1'" do + resource[:revision] = 'only/remote' + 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(:update_submodules) + provider.expects(:git).with('branch', '-a').returns(resource.value(:revision)) + provider.expects(:git).with('checkout', '--force', resource.value(:revision)) + provider.create + end + end + context "with a revision that is not a remote branch" do it "should execute 'git clone' and 'git reset --hard'" do resource[:revision] = 'a-commit-or-tag' |