diff options
author | Ashley Penney <ashley.penney@puppetlabs.com> | 2013-12-02 09:30:42 -0800 |
---|---|---|
committer | Ashley Penney <ashley.penney@puppetlabs.com> | 2013-12-02 09:30:42 -0800 |
commit | a96a42e38b6c6d306ef158250658ae5673f383a3 (patch) | |
tree | 624591a7ef2f67b2bee80b05e2357da18fc257c0 /lib | |
parent | f2f1a82d72ec8afb50c32206abeaa32923ee410b (diff) | |
parent | 8837be29ff114228f86d67c59337119120690e44 (diff) | |
download | puppet-vcsrepo-a96a42e38b6c6d306ef158250658ae5673f383a3.tar.gz puppet-vcsrepo-a96a42e38b6c6d306ef158250658ae5673f383a3.tar.bz2 |
Merge pull request #106 from mikegerwitz/master
Correctly handle detached head for 'latest' on latest Git versions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/vcsrepo/git.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb index 47e84d2..17275c4 100644 --- a/lib/puppet/provider/vcsrepo/git.rb +++ b/lib/puppet/provider/vcsrepo/git.rb @@ -39,9 +39,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) def latest branch = on_branch? - if branch == 'master' - return get_revision("#{@resource.value(:remote)}/HEAD") - elsif branch == '(no branch)' + if branch == '' return get_revision('HEAD') else return get_revision("#{@resource.value(:remote)}/%s" % branch) @@ -255,7 +253,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo) end def on_branch? - at_path { git_with_identity('branch', '-a') }.split(/\n/).grep(/\*/).first.to_s.gsub('*', '').strip + at_path { git_with_identity('rev-parse', '--abbrev-ref', 'HEAD') } end def tags |