summaryrefslogtreecommitdiff
path: root/lib/puppet/provider
diff options
context:
space:
mode:
authorBryan Jen <bryan.jen@gmail.com>2015-08-04 08:38:54 -0700
committerBryan Jen <bryan.jen@gmail.com>2015-08-04 08:38:54 -0700
commit5ef1b4740e1aab6672ee3971762c796c898ca639 (patch)
tree753956993a40f5a2163746e7181c34cb3201bfaf /lib/puppet/provider
parent266b20510b9eec7e8e91096f5aa370ae52a136e7 (diff)
parentd68402d1f930d5a30f1ec9224ac3791b6d9d29b9 (diff)
downloadpuppet-vcsrepo-5ef1b4740e1aab6672ee3971762c796c898ca639.tar.gz
puppet-vcsrepo-5ef1b4740e1aab6672ee3971762c796c898ca639.tar.bz2
Merge pull request #260 from mhaskel/MODULES-1800
MODULES-1800 - fix case where ensure => latest and no revision specified
Diffstat (limited to 'lib/puppet/provider')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index bf11f3d..f13802b 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -45,7 +45,11 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
#
# @return [String] Returns the target sha/tag/branch
def latest
- @resource.value(:revision)
+ if not @resource.value(:revision) and branch = on_branch?
+ return branch
+ else
+ return @resource.value(:revision)
+ end
end
# Get the current revision of the repo (tag/branch/sha)
@@ -281,7 +285,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
# handle upstream branch changes
# @!visibility private
def checkout(revision = @resource.value(:revision))
- if !local_branch_revision? && remote_branch_revision?
+ if !local_branch_revision?(revision) && remote_branch_revision?(revision)
#non-locally existant branches (perhaps switching to a branch that has never been checked out)
at_path { git_with_identity('checkout', '--force', '-b', revision, '--track', "#{@resource.value(:remote)}/#{revision}") }
else