summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo
diff options
context:
space:
mode:
authorBrett Lentz <blentz@classmates.com>2010-09-14 11:24:14 -0700
committerBrett Lentz <blentz@classmates.com>2010-09-14 11:24:14 -0700
commit21faae50158ebca5b08c855140885561d42fb37d (patch)
treea09c23548938d3fe470345ed0e9388297df321a9 /lib/puppet/provider/vcsrepo
parent81787d494012f969e10d4af34193c8e81a6dc8b7 (diff)
git: correct checking out latest revision of a branch.
Diffstat (limited to 'lib/puppet/provider/vcsrepo')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 888c651..38c247b 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -38,7 +38,12 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
end
def latest
- return get_revision('origin/HEAD')
+ branch = on_branch?
+ if branch == 'master'
+ return get_revision('origin/HEAD')
+ else
+ return get_revision('origin/%s' % branch)
+ end
end
def revision
@@ -207,6 +212,10 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
at_path { git('branch', '-a') }.gsub('*', ' ').split(/\n/).map { |line| line.strip }
end
+ def on_branch?
+ at_path { git('branch', '-a') }.split(/\n/).grep(/\*/).to_s.gsub('*', '').strip
+ end
+
def tags
at_path { git('tag', '-l') }.split(/\n/).map { |line| line.strip }
end