git.rb: update_references before touching tags. tags created since last vcsrepo run...
authorAdam Gandelman <adam@janrain.com>
Tue, 15 Mar 2011 17:22:17 +0000 (01:22 +0800)
committerJames Turnbull <james@lovedthanlost.net>
Sat, 21 May 2011 01:04:06 +0000 (18:04 -0700)
lib/puppet/provider/vcsrepo/git.rb

index bbcf14c..662ddff 100644 (file)
@@ -42,12 +42,19 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
     if branch == 'master'
       return get_revision('origin/HEAD')
     else
-      return get_revision('origin/%s' % branch)
+        return get_revision('origin/%s' % branch)
     end
   end
 
   def revision
-    return get_revision('HEAD')
+    update_references
+    current   = at_path { git('rev-parse', 'HEAD') }
+    canonical = at_path { git('rev-parse', @resource.value(:revision)) }
+    if current == canonical
+      @resource.value(:revision)
+    else
+      current
+    end
   end
 
   def revision=(desired)