summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2014-09-30 13:14:05 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2014-09-30 13:14:05 -0700
commit807c4fa0a1d8986eb041c1c576ed441a47422ad2 (patch)
tree893855603d5454e1a9556f05c44a7943d4ad539f
parenta93b2b67209db49ebbf9a52655894e3b7e150618 (diff)
parenta37f1944bd95a10e261070e828601304fa898eeb (diff)
downloadchef-807c4fa0a1d8986eb041c1c576ed441a47422ad2.tar.gz
Merge pull request #2131 from opscode/jdmundrawala/git-windows
Windows can have git as well
-rw-r--r--lib/chef/provider/git.rb3
-rw-r--r--spec/unit/provider/git_spec.rb7
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 9a2e6e2291..5b785c31fc 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -150,7 +150,8 @@ class Chef
converge_by("checkout ref #{sha_ref} branch #{@new_resource.revision}") do
# checkout into a local branch rather than a detached HEAD
- shell_out!("git branch -f #{@new_resource.checkout_branch} #{sha_ref}; git checkout #{@new_resource.checkout_branch}", run_options(:cwd => @new_resource.destination))
+ shell_out!("git branch -f #{@new_resource.checkout_branch} #{sha_ref}", run_options(:cwd => @new_resource.destination))
+ shell_out!("git checkout #{@new_resource.checkout_branch}", 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
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index 69a6443c67..20b13c4cb0 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -245,9 +245,10 @@ SHAS
end
it "runs a checkout command with default options" do
- expected_cmd = 'git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c; git checkout deploy'
- @provider.should_receive(:shell_out!).with(expected_cmd, :cwd => "/my/deploy/dir",
- :log_tag => "git[web2.0 app]")
+ @provider.should_receive(:shell_out!).with('git branch -f deploy d35af14d41ae22b19da05d7d03a0bafc321b244c', :cwd => "/my/deploy/dir",
+ :log_tag => "git[web2.0 app]").ordered
+ @provider.should_receive(:shell_out!).with('git checkout deploy', :cwd => "/my/deploy/dir",
+ :log_tag => "git[web2.0 app]").ordered
@provider.checkout
end