install: respect pins when auto-upgrading

Closes #12716.
This commit is contained in:
Carlo Cabrera 2022-01-13 23:57:51 +08:00
parent 3ba6afb1d3
commit dd551a8060
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -125,7 +125,7 @@ module Homebrew
# dependencies. Therefore before performing other checks we need to be # dependencies. Therefore before performing other checks we need to be
# sure --force flag is passed. # sure --force flag is passed.
if f.outdated? if f.outdated?
unless Homebrew::EnvConfig.no_install_upgrade? if !Homebrew::EnvConfig.no_install_upgrade? && !f.pinned?
puts "#{f.name} #{f.linked_version} is already installed but outdated (so it will be upgraded)." puts "#{f.name} #{f.linked_version} is already installed but outdated (so it will be upgraded)."
return true return true
end end
@ -215,7 +215,7 @@ module Homebrew
elsif f.linked? elsif f.linked?
message = "#{f.name} #{f.linked_version} is already installed" message = "#{f.name} #{f.linked_version} is already installed"
if f.outdated? && !head if f.outdated? && !head
unless Homebrew::EnvConfig.no_install_upgrade? if !Homebrew::EnvConfig.no_install_upgrade? && !f.pinned?
puts "#{message} but outdated (so it will be upgraded)." puts "#{message} but outdated (so it will be upgraded)."
return true return true
end end