summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-07-13 12:48:05 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-08-16 15:03:38 +0900
commit7bb3e637ffedf34fa148d4fbf35b57681490c7e1 (patch)
tree727998f14bb0c8682039f77fccbb70da19269717 /lib
parentc57ab646cbefc50a8e8d21faec8a60643b1a057c (diff)
[rubygems/rubygems] Don't update locked sources when not necessary
https://github.com/rubygems/rubygems/commit/cfc82b592a
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/definition.rb9
-rw-r--r--lib/bundler/source_list.rb4
2 files changed, 5 insertions, 8 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index f970301a23..8d90e2501d 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -813,16 +813,17 @@ module Bundler
dep = @dependencies.find {|d| s.satisfies?(d) }
lockfile_source = s.source
- # Replace the locked dependency's source with the equivalent source from the Gemfile
- s.source = if dep
+ if dep
gemfile_source = dep.source || default_source
@specs_that_changed_sources << s if gemfile_source != lockfile_source
deps << dep if !dep.source || lockfile_source.include?(dep.source)
- gemfile_source
+ # Replace the locked dependency's source with the equivalent source from the Gemfile
+ s.source = gemfile_source
else
- sources.get_with_fallback(lockfile_source)
+ # Replace the locked dependency's source with the default source, if the locked source is no longer in the Gemfile
+ s.source = default_source unless sources.get(lockfile_source)
end
next if @unlock[:sources].include?(s.source.name)
diff --git a/lib/bundler/source_list.rb b/lib/bundler/source_list.rb
index 63798db941..4419695b7f 100644
--- a/lib/bundler/source_list.rb
+++ b/lib/bundler/source_list.rb
@@ -101,10 +101,6 @@ module Bundler
source_list_for(source).find {|s| equivalent_source?(source, s) }
end
- def get_with_fallback(source)
- get(source) || default_source
- end
-
def lock_sources
lock_other_sources + lock_rubygems_sources
end