summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2013-03-06 17:06:26 +0100
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2013-03-06 18:24:02 +0100
commit6915fa7e3799ff56233cf7e2c4d24686e435c401 (patch)
tree00e46d6eff22c04ef0954e67fccbbc89637ef80c /lib
parent04851c28b12973c679fc9f234fd0f5a193df9d7a (diff)
Update origin if necessary before checking revision
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 9254243..61c225d 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -93,8 +93,18 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
working_copy_exists? || bare_exists?
end
+ def update_remote_origin_url
+ current = git_with_identity('config', 'remote.origin.url')
+ unless @resource.value(:source).nil?
+ if current.nil? or current.strip != @resource.value(:source)
+ git_with_identity('config', 'remote.origin.url', @resource.value(:source))
+ end
+ end
+ end
+
def update_references
at_path do
+ update_remote_origin_url
git_with_identity('fetch', @resource.value(:remote))
git_with_identity('fetch', '--tags', @resource.value(:remote))
update_owner_and_excludes
@@ -250,6 +260,7 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
create
end
at_path do
+ update_remote_origin_url
git_with_identity('fetch', @resource.value(:remote))
git_with_identity('fetch', '--tags', @resource.value(:remote))
end