summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2015-06-30 14:08:11 -0700
committerHunter Haugen <hunter@puppetlabs.com>2015-06-30 14:08:11 -0700
commit231f711e3f0ccb8601bea55f0e6d562b8674488e (patch)
treed3b2f0460a2d41cdccd0d29b0f3e40782303b2a8
parent3a437ea1bc4eafb64621911c34e9821f1e10241b (diff)
parentb3cddcbd57639acbf0c4a7fa671a70f787e010da (diff)
downloadpuppet-vcsrepo-231f711e3f0ccb8601bea55f0e6d562b8674488e.tar.gz
puppet-vcsrepo-231f711e3f0ccb8601bea55f0e6d562b8674488e.tar.bz2
Merge pull request #256 from keeleysam/master
fix for detached HEAD on git 2.4+
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 8074950..bf11f3d 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -329,11 +329,13 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
at_path { git_with_identity('branch', '-a') }.gsub('*', ' ').split(/\n/).map { |line| line.strip }
end
+ # git < 2.4 returns 'detached from'
+ # git 2.4+ returns 'HEAD detached at'
# @!visibility private
def on_branch?
at_path {
matches = git_with_identity('branch', '-a').match /\*\s+(.*)/
- matches[1] unless matches[1].match /(\(detached from|\(no branch)/
+ matches[1] unless matches[1].match /(\(detached from|\(HEAD detached at|\(no branch)/
}
end