summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorJohn Goulah <jgoulah@gmail.com>2012-12-28 16:15:34 -0500
committerBryan McLellan <btm@opscode.com>2013-11-26 07:31:19 -0800
commit376177d9d3ebb0a239ea5a43fd64b2b74f38b361 (patch)
tree80d6f3d2cfddb5778c4b337450d4d05cc22a98b5 /lib/chef/provider
parentce6135e76f1be4e1496a052188183e63332ea7dc (diff)
downloadchef-376177d9d3ebb0a239ea5a43fd64b2b74f38b361.tar.gz
add enable_checkout attribute; add ability to override 'deploy' with checkout_branch name
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/git.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index b22004eda0..ac128b7d2f 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -151,10 +151,13 @@ class Chef
def checkout
sha_ref = target_revision
- 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 deploy #{sha_ref}", run_options(:cwd => @new_resource.destination))
- Chef::Log.info "#{@new_resource} checked out branch: #{@new_resource.revision} reference: #{sha_ref}"
+
+ 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
end
end