From adce58dc9e10fc49733f5f49c617f29d90f3a767 Mon Sep 17 00:00:00 2001 From: Cody Cutrer Date: Tue, 10 Oct 2023 08:15:02 -0600 Subject: [PATCH] skip pre-install when we're unlocking (#13) --- lib/bundler/multilock.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/bundler/multilock.rb b/lib/bundler/multilock.rb index 6c73018..22af071 100644 --- a/lib/bundler/multilock.rb +++ b/lib/bundler/multilock.rb @@ -425,9 +425,16 @@ def write_lockfile(lockfile_definition, lockfile, install:, dependency_changes: orig_definition = definition.dup # we might need it twice + # install gems for the exact current version of the lockfile + # this ensures it doesn't re-resolve with only (different) + # local gems after you've pulled down an update to the lockfile + # from someone else if current_lockfile.exist? && install Bundler.settings.temporary(frozen: true) do current_definition = builder.to_definition(current_lockfile, {}) + # if something has changed, we skip this step; it's unlocking anyway + next unless current_definition.no_resolve_needed? + current_definition.resolve_with_cache! if current_definition.missing_specs.any? Bundler.with_default_lockfile(current_lockfile) do