summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Goulah <jgoulah@gmail.com>2013-02-03 16:29:32 -0500
committerBryan McLellan <btm@opscode.com>2013-11-26 07:31:19 -0800
commit9621c3b58c766dffdaadf7ae5436b530cc9d5bbe (patch)
treee8cd7ef6df9a2203fde7e3c7125ae6c480b584d8
parent376177d9d3ebb0a239ea5a43fd64b2b74f38b361 (diff)
downloadchef-9621c3b58c766dffdaadf7ae5436b530cc9d5bbe.tar.gz
move check up to wrap checkout called from action_checkout
-rw-r--r--lib/chef/provider/git.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index ac128b7d2f..8f0b5c1845 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -75,7 +75,9 @@ class Chef
def action_checkout
if target_dir_non_existent_or_empty?
clone
- checkout
+ if @new_resource.enable_checkout
+ checkout
+ end
enable_submodules
add_remotes
else
@@ -152,12 +154,10 @@ class Chef
def checkout
sha_ref = target_revision
- if @new_resource.enable_checkout
- converge_by("checkout ref #{sha_ref} branch #{@new_resource.revision}") do
- # checkout into a local branch rather than a detached HEAD
- shell_out!("git checkout -b #{@new_resource.checkout_branch} #{sha_ref}", run_options(:cwd => @new_resource.destination))
- Chef::Log.info "#{@new_resource} checked out branch: #{@new_resource.revision} onto: #{@new_resource.checkout_branch} reference: #{sha_ref}"
- end
+ converge_by("checkout ref #{sha_ref} branch #{@new_resource.revision}") do
+ # checkout into a local branch rather than a detached HEAD
+ shell_out!("git checkout -b #{@new_resource.checkout_branch} #{sha_ref}", run_options(:cwd => @new_resource.destination))
+ Chef::Log.info "#{@new_resource} checked out branch: #{@new_resource.revision} onto: #{@new_resource.checkout_branch} reference: #{sha_ref}"
end
end