summaryrefslogtreecommitdiff
path: root/lib/chef/provider/git.rb
diff options
context:
space:
mode:
authorPawel Kozlowski <pawel.kozlowski@u2i.com>2012-11-12 01:20:50 +0100
committerBryan McLellan <btm@opscode.com>2013-06-18 11:09:13 -0700
commitc5f346229fd31867734635b555e593ce08d1d8e0 (patch)
treec99e6224b21cb9e4350f30e4136f1d1331484c4f /lib/chef/provider/git.rb
parenta961f079d07542030140df355c167f3a506a764c (diff)
downloadchef-c5f346229fd31867734635b555e593ce08d1d8e0.tar.gz
[CHEF-955] Added condition running remote set-url only when neccessary
Diffstat (limited to 'lib/chef/provider/git.rb')
-rw-r--r--lib/chef/provider/git.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index eae9f4f871..c7e2fccc16 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -194,8 +194,10 @@ class Chef
remote_status = shell_out!(check_remote_command, run_options(:cwd => @new_resource.destination, :returns => [0,1,2]))
case remote_status.exitstatus
when 0
- update_remote_url_command = "git remote set-url #{@new_resource.remote} #{@new_resource.repository}"
- shell_out!(update_remote_url_command, run_options(:cwd => @new_resource.destination))
+ unless remote_status.stdout.strip.eql?(@new_resource.repository)
+ update_remote_url_command = "git remote set-url #{@new_resource.remote} #{@new_resource.repository}"
+ shell_out!(update_remote_url_command, run_options(:cwd => @new_resource.destination))
+ end
when 1
add_remote_command = "git remote add #{@new_resource.remote} #{@new_resource.repository}"
shell_out!(add_remote_command, run_options(:cwd => @new_resource.destination))