diff --git a/lib/bundler/multilock.rb b/lib/bundler/multilock.rb index b76cdff..a70e0eb 100644 --- a/lib/bundler/multilock.rb +++ b/lib/bundler/multilock.rb @@ -271,6 +271,10 @@ def after_install_all(install: true) dependency_changes ||= spec != parent_spec + if spec.source != parent_spec.source + parent_spec = parent_spec.dup + parent_spec.source = spec.source + end parent_spec end diff --git a/spec/bundler/multilock_spec.rb b/spec/bundler/multilock_spec.rb index 9ec3dba..c453690 100644 --- a/spec/bundler/multilock_spec.rb +++ b/spec/bundler/multilock_spec.rb @@ -313,6 +313,34 @@ end end + it "maintains consistency across local gem's lockfiless when one is included in the other" do + with_gemfile(<<~RUBY) do + lockfile("local_test/Gemfile.lock", + gemfile: "local_test/Gemfile") + + gem "local_test", path: "local_test" + gem "net-smtp", "0.3.2" + RUBY + create_local_gem("local_test", <<~RUBY) + spec.add_dependency "net-smtp", "~> 0.3" + RUBY + + invoke_bundler("install") + + replace_lockfile_pin("local_test/Gemfile.lock", "net-smtp", "0.3.3") + + # write_gemfile(<<~RUBY) + # lockfile("local_test/Gemfile.lock", + # gemfile: "local_test/Gemfile") + + # gem "net-smtp", "~> 0.3.2" + # RUBY + + invoke_bundler("install") + expect(File.read("local_test/Gemfile.lock")).to include("0.3.2") + end + end + it "syncs from a parent lockfile" do with_gemfile(<<~RUBY) do lockfile do