Add HOMEBREW_NO_INSTALL_UPGRADE

This commit is contained in:
Connor Mann 2021-06-10 15:06:12 -04:00
parent 56e6710064
commit b6cb3d2b6a
No known key found for this signature in database
GPG Key ID: 5886083015754F6F
2 changed files with 10 additions and 1 deletions

View File

@ -257,6 +257,10 @@ module Homebrew
"`HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS` days.", "`HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS` days.",
boolean: true, boolean: true,
}, },
HOMEBREW_NO_INSTALL_UPGRADE: {
description: "If set, `brew install` will not automatically upgrade installed and out of date formulae",
boolean: true,
},
HOMEBREW_PRY: { HOMEBREW_PRY: {
description: "If set, use Pry for the `brew irb` command.", description: "If set, use Pry for the `brew irb` command.",
boolean: true, boolean: true,

View File

@ -351,7 +351,12 @@ class FormulaInstaller
message = <<~EOS message = <<~EOS
#{formula.name} #{formula.linked_version} is already installed #{formula.name} #{formula.linked_version} is already installed
EOS EOS
if only_deps? if Homebrew::EnvConfig.no_install_upgrade? && formula.outdated? && !formula.head?
message += <<~EOS
To upgrade to #{formula.pkg_version}, run:
brew upgrade #{formula.full_name}
EOS
elsif only_deps?
message = nil message = nil
else else
# some other version is already installed *and* linked # some other version is already installed *and* linked