Merge pull request #14435 from MikeMcQuaid/install_from_api_head

install: better error when using API and --HEAD.
This commit is contained in:
Mike McQuaid 2023-01-26 11:40:40 +00:00 committed by GitHub
commit 7b4f025ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 3 deletions

View File

@ -96,8 +96,8 @@ begin
odie <<~EOS
This command cannot be run while Homebrew/homebrew-core is untapped and
HOMEBREW_NO_INSTALL_FROM_API is unset! To resolve please run:
brew tap Homebrew/core
export HOMEBREW_NO_INSTALL_FROM_API=1
brew tap Homebrew/core
and retry this command.
EOS
end

View File

@ -65,8 +65,8 @@ module Homebrew
<<~EOS
#{not_exist_message}
This is expected with HOMEBREW_NO_INSTALL_FROM_API unset! To resolve please run:
brew tap Homebrew/core
export HOMEBREW_NO_INSTALL_FROM_API=1
brew tap Homebrew/core
and retry this command.
EOS
elsif args.cask?

View File

@ -1185,8 +1185,8 @@ class FormulaInstaller
odie <<~EOS
Unable to build #{formula.name} from source while Homebrew/homebrew-core is
untapped and HOMEBREW_NO_INSTALL_FROM_API is unset! To resolve please run:
brew tap Homebrew/core
export HOMEBREW_NO_INSTALL_FROM_API=1
brew tap Homebrew/core
and retry.
EOS
else

View File

@ -113,6 +113,15 @@ module Homebrew
EOS
end
if head && Homebrew::EnvConfig.install_from_api?
raise UsageError, <<~EOS
--HEAD is not supported with HOMEBREW_NO_INSTALL_FROM_API unset! To resolve please run:
export HOMEBREW_NO_INSTALL_FROM_API=1
brew tap Homebrew/core
and retry this command.
EOS
end
# --HEAD, fail with no head defined
odie "No head is defined for #{f.full_name}" if head && f.head.nil?