diff options
-rw-r--r-- | lib/bundler/source.rb | 9 | ||||
-rw-r--r-- | spec/install/git_spec.rb | 23 |
2 files changed, 4 insertions, 28 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb index f5d55a0d79..1609db65a3 100644 --- a/lib/bundler/source.rb +++ b/lib/bundler/source.rb @@ -716,9 +716,9 @@ module Bundler path = Pathname.new(path) path = path.expand_path(Bundler.root) unless path.relative? - unless options["branch"] + unless options["branch"] || options["tag"] || options["ref"] raise GitError, "Cannot use local override for #{name} at #{path} because " \ - ":branch is not specified in Gemfile. Specify a branch or check " \ + ":branch, :tag, or :ref is not specified in Gemfile. Specify a commit reference or check " \ "`bundle config --delete` to remove the local override" end @@ -733,11 +733,6 @@ module Bundler # so the Gemfile.lock always picks up the new revision. @git_proxy = GitProxy.new(path, uri, ref) - if 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 048880bab5..54bac6e064 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 "explodes if branch is not given" do + it "explodes if branch, tag, or ref is not given" do build_git "rack", "0.8" FileUtils.cp_r("#{lib_path('rack-0.8')}/.", lib_path('local-rack')) @@ -265,26 +265,7 @@ describe "bundle install with git sources" do bundle %|config local.rack #{lib_path('local-rack')}| bundle :install - out.should =~ /because :branch is not specified in Gemfile/ - 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/ + out.should =~ /because :branch, :tag, or :ref is not specified in Gemfile/ end it "explodes on invalid revision" do |