diff options
author | André Arko <andre@arko.net> | 2012-06-12 22:02:11 -0700 |
---|---|---|
committer | André Arko <andre@arko.net> | 2012-06-12 22:02:11 -0700 |
commit | 2d4f8ddaccfe6fc460045b93b0c3e44715a94c98 (patch) | |
tree | 4b4e95eea9f95293a497d8a1965e4157b0412dc7 | |
parent | 734342914f367144e4e5400916ca224164fc09b1 (diff) | |
parent | 3366c03ebdb76186d774c7b39c199a8a0ccafede (diff) | |
download | bundler-2d4f8ddaccfe6fc460045b93b0c3e44715a94c98.tar.gz |
Merge remote-tracking branch 'rkh/optional-branch'
Conflicts:
lib/bundler/source.rb
spec/install/git_spec.rb
-rw-r--r-- | lib/bundler/source.rb | 5 | ||||
-rw-r--r-- | spec/install/git_spec.rb | 23 |
2 files changed, 26 insertions, 2 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index c708791d48..aa05afa535 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -727,6 +727,11 @@ module Bundler # so the Gemfile.lock always picks up the new revision. @git_proxy = GitProxy.new(path, uri, ref) + if options["branch"] and git_proxy.branch != options["branch"] + raise GitError, "Local override for #{name} at #{path} is using branch " \ + "#{git_proxy.branch} but Gemfile specifies #{options["branch"]}" + end + changed = cached_revision && cached_revision != git_proxy.revision if changed && !git_proxy.contains?(cached_revision) diff --git a/spec/install/git_spec.rb b/spec/install/git_spec.rb index 85c60aa3b9..c1c3af54a4 100644 --- a/spec/install/git_spec.rb +++ b/spec/install/git_spec.rb @@ -254,7 +254,7 @@ describe "bundle install with git sources" do out.should =~ /Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/ end - it "does not explode if branch, tag, or ref is not given" do + it "does not explode if branch is not given" do build_git "rack", "0.8" FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack')) @@ -265,7 +265,26 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should_not =~ /is not specified in Gemfile/ + out.should =~ /Your bundle is complete!/ + end + + it "explodes on different branches" do + build_git "rack", "0.8" + + FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack')) + + update_git "rack", "0.8", :path => lib_path('local-rack'), :branch => "another" do |s| + s.write "lib/rack.rb", "puts :LOCAL" + end + + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack", :git => "#{lib_path('rack-0.8')}", :branch => "master" + G + + bundle %|config local.rack #{lib_path('local-rack')}| + bundle :install + out.should =~ /is using branch another but Gemfile specifies master/ end it "explodes on invalid revision" do |