Skip to content

Commit

Permalink
[rubygems/rubygems] Extract Definition#no_resolved_needed?
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Jun 14, 2023
1 parent 4f1b181 commit 21238f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/bundler/definition.rb
Expand Up @@ -281,7 +281,7 @@ def resolve
@resolve ||= if Bundler.frozen_bundle?
Bundler.ui.debug "Frozen, using resolution from the lockfile"
@locked_specs
elsif !unlocking? && nothing_changed?
elsif no_resolve_needed?
if deleted_deps.any?
Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile"
SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
Expand Down Expand Up @@ -477,6 +477,10 @@ def nothing_changed?
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@incomplete_lockfile
end

def no_resolve_needed?
!unlocking? && nothing_changed?
end

def unlocking?
@unlocking
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/runtime.rb
Expand Up @@ -94,7 +94,7 @@ def self.definition_method(meth)
definition_method :requires

def lock(opts = {})
return if @definition.nothing_changed? && !@definition.unlocking?
return if @definition.no_resolve_needed?
@definition.lock(Bundler.default_lockfile, opts[:preserve_unknown_sections])
end

Expand Down

0 comments on commit 21238f3

Please sign in to comment.