cask/installer: do not install tap during conflict checking

If the tap of the conflicted cask is not installed, we should just skip it.
This matches the behavior of formula installation.

Without this, running `brew install dropbox` would result to install
the `homebrew/cask-versions` tap.

Fixes #9125.
This commit is contained in:
Cheng XU 2020-12-22 15:32:05 -08:00
parent 53ef74f674
commit 72a346e6c8
No known key found for this signature in database
GPG Key ID: 8794B5D7A3C67F70

View File

@ -120,6 +120,11 @@ module Cask
return unless @cask.conflicts_with return unless @cask.conflicts_with
@cask.conflicts_with[:cask].each do |conflicting_cask| @cask.conflicts_with[:cask].each do |conflicting_cask|
if (match = conflicting_cask.match(HOMEBREW_TAP_CASK_REGEX))
conflicting_cask_tap = Tap.fetch(match[1], match[2])
next unless conflicting_cask_tap.installed?
end
conflicting_cask = CaskLoader.load(conflicting_cask) conflicting_cask = CaskLoader.load(conflicting_cask)
raise CaskConflictError.new(@cask, conflicting_cask) if conflicting_cask.installed? raise CaskConflictError.new(@cask, conflicting_cask) if conflicting_cask.installed?
rescue CaskUnavailableError rescue CaskUnavailableError