Skip to content

Commit b93be94

Browse files
committed
fix syncing embedded gems with different paths
1 parent ea4392e commit b93be94

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

lib/bundler/multilock.rb

+4
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,10 @@ def after_install_all(install: true)
271271

272272
dependency_changes ||= spec != parent_spec
273273

274+
if spec.source != parent_spec.source
275+
parent_spec = parent_spec.dup
276+
parent_spec.source = spec.source
277+
end
274278
parent_spec
275279
end
276280

spec/bundler/multilock_spec.rb

+28
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,34 @@
313313
end
314314
end
315315

316+
it "maintains consistency across local gem's lockfiless when one is included in the other" do
317+
with_gemfile(<<~RUBY) do
318+
lockfile("local_test/Gemfile.lock",
319+
gemfile: "local_test/Gemfile")
320+
321+
gem "local_test", path: "local_test"
322+
gem "net-smtp", "0.3.2"
323+
RUBY
324+
create_local_gem("local_test", <<~RUBY)
325+
spec.add_dependency "net-smtp", "~> 0.3"
326+
RUBY
327+
328+
invoke_bundler("install")
329+
330+
replace_lockfile_pin("local_test/Gemfile.lock", "net-smtp", "0.3.3")
331+
332+
# write_gemfile(<<~RUBY)
333+
# lockfile("local_test/Gemfile.lock",
334+
# gemfile: "local_test/Gemfile")
335+
336+
# gem "net-smtp", "~> 0.3.2"
337+
# RUBY
338+
339+
invoke_bundler("install")
340+
expect(File.read("local_test/Gemfile.lock")).to include("0.3.2")
341+
end
342+
end
343+
316344
it "syncs from a parent lockfile" do
317345
with_gemfile(<<~RUBY) do
318346
lockfile do

0 commit comments

Comments
 (0)