Merge pull request #18536 from boblail/lail/install-unlinked-formulae-when---overwrite-is-passed

feat: Install an unlinked formula via `brew install` if `--overwrite`  is passed
This commit is contained in:
Mike McQuaid 2024-10-13 17:34:57 +01:00 committed by GitHub
commit e0668067df
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -289,6 +289,7 @@ module Homebrew
only_dependencies: args.only_dependencies?, only_dependencies: args.only_dependencies?,
force: args.force?, force: args.force?,
quiet: args.quiet?, quiet: args.quiet?,
overwrite: args.overwrite?,
) )
end end

View File

@ -60,7 +60,8 @@ module Homebrew
fetch_head: false, fetch_head: false,
only_dependencies: false, only_dependencies: false,
force: false, force: false,
quiet: false quiet: false,
overwrite: false
) )
# head-only without --HEAD is an error # head-only without --HEAD is an error
if !head && formula.stable.nil? if !head && formula.stable.nil?
@ -132,7 +133,7 @@ module Homebrew
The currently linked version is: #{formula.linked_version} The currently linked version is: #{formula.linked_version}
EOS EOS
end end
elsif only_dependencies elsif only_dependencies || (!formula.linked? && overwrite)
msg = nil msg = nil
return true return true
elsif !formula.linked? || formula.keg_only? elsif !formula.linked? || formula.keg_only?