Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'CHEF-2105'

  • Loading branch information...
commit 24782b39175314013dcb5883a679b55848a7754c 2 parents 5d8e2c9 + 4b53525
@danielsdeleo danielsdeleo authored
View
2  chef/lib/chef/knife/cookbook_site_install.rb
@@ -44,7 +44,7 @@ class CookbookSiteInstall < Knife
:description => "A colon-separated path to look for cookbooks in",
:proc => lambda { |o| o.split(":") }
- option :branch_default,
+ option :default_branch,
:short => "-B BRANCH",
:long => "--branch BRANCH",
:description => "Default branch to work with",
View
3  chef/lib/chef/knife/core/cookbook_scm_repo.rb
@@ -34,6 +34,7 @@ def initialize(repo_path, ui, opts={})
@repo_path = repo_path
@ui = ui
@default_branch = 'master'
+ apply_opts(opts)
end
def sanity_check
@@ -133,8 +134,6 @@ def apply_opts(opts)
case option.to_s
when 'default_branch'
@default_branch = value
- else
- raise ArgumentError, "invalid option `#{option}' passed to CookbookRepo.new()"
end
end
end
View
11 chef/spec/unit/knife/core/cookbook_scm_repo_spec.rb
@@ -173,4 +173,15 @@
@cookbook_repo.finalize_updates_to("apache2", "1.2.3").should be_true
end
end
+
+ describe "when a custom default branch is specified" do
+ before do
+ @cookbook_repo = Chef::Knife::CookbookSCMRepo.new(@repo_path, @ui, :default_branch => 'develop')
+ end
+
+ it "resets to default state by checking out the default branch" do
+ @cookbook_repo.should_receive(:shell_out!).with('git checkout develop', :cwd => @repo_path)
+ @cookbook_repo.reset_to_default_state
+ end
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.