Skip to content
Snippets Groups Projects
Unverified Commit 3ca68c07 authored by Rylan Polster's avatar Rylan Polster
Browse files

Don't tap user-untapped official taps

parent 152eac33
No related branches found
No related tags found
No related merge requests found
......@@ -132,7 +132,10 @@ begin
possible_tap = OFFICIAL_CMD_TAPS.find { |_, cmds| cmds.include?(cmd) }
possible_tap = Tap.fetch(possible_tap.first) if possible_tap
odie "Unknown command: #{cmd}" if !possible_tap || possible_tap.installed?
untapped_official_taps = Homebrew::Settings.read(:untapped)&.split(";") || []
if !possible_tap || possible_tap.installed? || untapped_official_taps.include?(possible_tap.name)
odie "Unknown command: #{cmd}"
end
# Unset HOMEBREW_HELP to avoid confusing the tap
with_env HOMEBREW_HELP: nil do
......
......@@ -5,6 +5,9 @@ class Tap
def self.install_default_cask_tap_if_necessary
return false if default_cask_tap.installed?
untapped_official_taps = Homebrew::Settings.read(:untapped)&.split(";") || []
return false if untapped_official_taps.include?(default_cask_tap.name)
default_cask_tap.install
true
end
......
......@@ -326,6 +326,17 @@ class Tap
.update_from_formula_names!(formula_names)
end
if official?
untapped = Homebrew::Settings.read(:untapped)&.split(";") || []
untapped -= [name]
if untapped.empty?
Homebrew::Settings.delete :untapped
else
Homebrew::Settings.write :untapped, untapped.join(";")
end
end
return if clone_target
return unless private?
return if quiet
......@@ -374,6 +385,15 @@ class Tap
Commands.rebuild_commands_completion_list
clear_cache
return unless official?
untapped = Homebrew::Settings.read(:untapped)&.split(";") || []
return if untapped.include? name
untapped << name
Homebrew::Settings.write :untapped, untapped.join(";")
end
# True if the {#remote} of {Tap} is customized.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment