Merge pull request #20612 from Homebrew/dug/simplify-affix-checks
Avoid repeated calls to affix checks
This commit is contained in:
commit
d9718cec92
@ -384,7 +384,7 @@ module Homebrew
|
|||||||
files_to_commits[file] ||= []
|
files_to_commits[file] ||= []
|
||||||
files_to_commits[file] << commit
|
files_to_commits[file] << commit
|
||||||
tap_file = (tap.path/file).to_s
|
tap_file = (tap.path/file).to_s
|
||||||
if (tap_file.start_with?("#{tap.formula_dir}/") || tap_file.start_with?("#{tap.cask_dir}/")) &&
|
if tap_file.start_with?("#{tap.formula_dir}/", "#{tap.cask_dir}/") &&
|
||||||
File.extname(file) == ".rb"
|
File.extname(file) == ".rb"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
@ -376,7 +376,7 @@ module OS
|
|||||||
|
|
||||||
return if @found.all? do |path|
|
return if @found.all? do |path|
|
||||||
realpath = Pathname.new(path).realpath.to_s
|
realpath = Pathname.new(path).realpath.to_s
|
||||||
allowlist.any? { |rack| realpath.start_with?(rack) }
|
realpath.start_with?(*allowlist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ module OS
|
|||||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/23251
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/23251
|
||||||
return true if HOMEBREW_TEMP.to_s == "/private/tmp" && filename.start_with?("/tmp/")
|
return true if HOMEBREW_TEMP.to_s == "/private/tmp" && filename.start_with?("/tmp/")
|
||||||
|
|
||||||
filename.start_with?(HOMEBREW_TEMP.to_s) || filename.start_with?(HOMEBREW_TEMP.realpath.to_s)
|
filename.start_with?(HOMEBREW_TEMP.to_s, HOMEBREW_TEMP.realpath.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -281,7 +281,7 @@ class Cmd
|
|||||||
true
|
true
|
||||||
# first two paths: reject references to Cellar or opt paths
|
# first two paths: reject references to Cellar or opt paths
|
||||||
# for unspecified dependencies
|
# for unspecified dependencies
|
||||||
elsif path.start_with?(cellar) || path.start_with?(opt)
|
elsif path.start_with?(cellar, opt)
|
||||||
dep = path[keg_regex, 2]
|
dep = path[keg_regex, 2]
|
||||||
dep && @deps.include?(dep)
|
dep && @deps.include?(dep)
|
||||||
elsif path.start_with?(prefix, cachedir, tmpdir)
|
elsif path.start_with?(prefix, cachedir, tmpdir)
|
||||||
|
@ -92,7 +92,7 @@ module UnpackStrategy
|
|||||||
|
|
||||||
strategies&.sort_by { |s| s.extensions.map(&:length).max || 0 }
|
strategies&.sort_by { |s| s.extensions.map(&:length).max || 0 }
|
||||||
&.reverse
|
&.reverse
|
||||||
&.find { |s| s.extensions.any? { |ext| extension.end_with?(ext) } }
|
&.find { |s| extension.end_with?(*s.extensions) }
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(path: Pathname).returns(T.nilable(UnpackStrategyType)) }
|
sig { params(path: Pathname).returns(T.nilable(UnpackStrategyType)) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user