summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-06-25 16:23:33 +0900
committerHomu <homu@barosl.com>2016-06-25 16:23:33 +0900
commitfaf82ccc97ab2441bd4fe849d12151fb347a81cf (patch)
treec1af681d696e93a255ec4e70b7bf6cfcd18a21c5
parent3b928d83c1b606b4598c6662528b20482762a14d (diff)
parent9cbf8fb404ad2faa30b10f493e8951dd0cdf0f31 (diff)
downloadbundler-faf82ccc97ab2441bd4fe849d12151fb347a81cf.tar.gz
Auto merge of #4716 - bundler:seg-no-re-resolve-part-deux, r=indirect
[Definition] Just search for changed specs in an exactly matching source \c @indirect
-rw-r--r--lib/bundler/definition.rb22
-rw-r--r--spec/install/gemfile/sources_spec.rb32
2 files changed, 38 insertions, 16 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 0305f404e3..7932d2d7e2 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -491,19 +491,11 @@ module Bundler
end
# Check if the specs of the given source changed
- # according to the locked source. A block should be
- # in order to specify how the locked version of
- # the source should be found.
- def specs_changed?(source, &block)
- locked = @locked_sources.find(&block)
-
- if locked
- unlocking = @locked_specs.any? do |locked_spec|
- locked_spec.source.class == locked.class && locked_spec.source != locked
- end
- end
+ # according to the locked source.
+ def specs_changed?(source)
+ locked = @locked_sources.find(source)
- !locked || unlocking || dependencies_for_source_changed?(source) || specs_for_source_changed?(source)
+ !locked || dependencies_for_source_changed?(source) || specs_for_source_changed?(source)
end
def dependencies_for_source_changed?(source)
@@ -536,15 +528,13 @@ module Bundler
end
locals.any? do |source, changed|
- changed || specs_changed?(source) {|o| source.class == o.class && source.uri == o.uri }
+ changed || specs_changed?(source)
end
end
def converge_paths
sources.path_sources.any? do |source|
- specs_changed?(source) do |ls|
- ls.class == source.class && ls.path == source.path
- end
+ specs_changed?(source)
end
end
diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb
index e216340fa5..f34a5f2aeb 100644
--- a/spec/install/gemfile/sources_spec.rb
+++ b/spec/install/gemfile/sources_spec.rb
@@ -413,4 +413,36 @@ describe "bundle install with gems on multiple sources" do
should_be_installed("bar 0.1")
end
end
+
+ context "re-resolving" do
+ context "when there is a mix of sources in the gemfile" do
+ before do
+ build_repo3
+ build_lib "path1"
+ build_lib "path2"
+ build_git "git1"
+ build_git "git2"
+
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rails"
+
+ source "file://#{gem_repo3}" do
+ gem "rack"
+ end
+
+ gem "path1", :path => "#{lib_path("path1-1.0")}"
+ gem "path2", :path => "#{lib_path("path2-1.0")}"
+ gem "git1", :git => "#{lib_path("git1-1.0")}"
+ gem "git2", :git => "#{lib_path("git2-1.0")}"
+ G
+ end
+
+ it "does not re-resolve" do
+ bundle :install, :verbose => true
+ expect(out).to include("using resolution from the lockfile")
+ expect(out).not_to include("re-resolving dependencies")
+ end
+ end
+ end
end