summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-06-03 14:03:38 +0200
committerHiroshi SHIBATA <[email protected]>2025-06-05 19:12:46 +0900
commit970eac1530081e4d56614b4c865fe1c5aae9532b ()
tree7335843b0130e8bfdb75d01912c03bc7ea373218 /lib
parente4933e1d93218ff740ea6ac552b309eca03ba5d1 (diff)
[rubygems/rubygems] Fix git source unlocking for multi-gem repositories like Rails
If you have ``` gem "rails", git: "https://.com/rails/rails" ``` and then explicitly pin to an older ref, like ``` gem "rails", git: "https://.com/rails/rails", ref: "https://.com/rubygems/rubygems/commit/99bacb5aa8e5" ``` Then `bundle install` fails, because locked sources fail to be updated to use the new source. This commit fixes the problem by making sure get their source properly replaced. https://.com/rubygems/rubygems/commit/5de8c2e0cf
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--lib/bundler/source_list.rb6
2 files changed, 2 insertions, 6 deletions
@@ -1045,7 +1045,7 @@ module Bundler
s.source = gemfile_source
else
# 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
source = s.source
@@ -103,7 +103,7 @@ module Bundler
end
def get(source)
- source_list_for(source).find {|s| equivalent_source?(source, s) }
end
def lock_sources
@@ -265,9 +265,5 @@ module Bundler
def equivalent_sources?(lock_sources, replacement_sources)
lock_sources.sort_by(&:identifier) == replacement_sources.sort_by(&:identifier)
end
-
- def equivalent_source?(source, other_source)
- source == other_source
- end
end
end