@@ -260,6 +260,9 @@ def after_install_all(install: true)
260
260
spec_precedences [ spec . name ] = precedence || :parent
261
261
end
262
262
263
+ lockfile . sources . map! do |source |
264
+ parent_lockfile . sources . find { |s | s == source } || source
265
+ end
263
266
# replace any duplicate specs with what's in the parent lockfile
264
267
lockfile . specs . map! do |spec |
265
268
parent_spec = cache . find_matching_spec ( parent_specs , spec )
@@ -268,9 +271,7 @@ def after_install_all(install: true)
268
271
269
272
dependency_changes ||= spec != parent_spec
270
273
271
- new_spec = parent_spec . dup
272
- new_spec . source = spec . source
273
- new_spec
274
+ parent_spec
274
275
end
275
276
276
277
lockfile . platforms . replace ( parent_lockfile . platforms ) . uniq!
@@ -483,6 +484,13 @@ def write_lockfile(lockfile_definition,
483
484
# from someone else
484
485
if current_lockfile . exist? && install
485
486
Bundler . settings . temporary ( frozen : true ) do
487
+ # it keeps the same sources as the builder, which now shares with
488
+ # `definition` above; give it its own copy to avoid stomping on it
489
+ builder . instance_variable_set (
490
+ :@sources ,
491
+ builder . instance_variable_get ( :@sources ) . dup
492
+ )
493
+
486
494
current_definition = builder . to_definition ( current_lockfile , { } )
487
495
# if something has changed, we skip this step; it's unlocking anyway
488
496
next unless current_definition . no_resolve_needed?
0 commit comments