Fix type errors

This commit is contained in:
Douglas Eichelberger 2023-03-06 15:00:50 -08:00
parent d56e2884aa
commit 1c44a8861d
2 changed files with 28 additions and 30 deletions

View File

@ -105,8 +105,6 @@ module Homebrew
arguments.concat UNBREWED_EXCLUDE_PATHS.flat_map { |d| %W[! -path #{d}] } arguments.concat UNBREWED_EXCLUDE_PATHS.flat_map { |d| %W[! -path #{d}] }
arguments.push ")" arguments.push ")"
# This is a false positive type error: https://github.com/sorbet/sorbet/issues/6812 cd(HOMEBREW_PREFIX) { safe_system("find", *arguments) }
T.unsafe(self).cd HOMEBREW_PREFIX
safe_system "find", *arguments
end end
end end

View File

@ -54,34 +54,34 @@ module Homebrew
end end
def git_log(cd_dir, path = nil, tap = nil, args:) def git_log(cd_dir, path = nil, tap = nil, args:)
# This is a false positive type error: https://github.com/sorbet/sorbet/issues/6812 cd cd_dir do
T.unsafe(self).cd cd_dir repo = Utils.popen_read("git", "rev-parse", "--show-toplevel").chomp
repo = Utils.popen_read("git", "rev-parse", "--show-toplevel").chomp if tap
if tap name = tap.to_s
name = tap.to_s git_cd = "$(brew --repo #{tap})"
git_cd = "$(brew --repo #{tap})" elsif cd_dir == HOMEBREW_REPOSITORY
elsif cd_dir == HOMEBREW_REPOSITORY name = "Homebrew/brew"
name = "Homebrew/brew" git_cd = "$(brew --repo)"
git_cd = "$(brew --repo)" else
else name, git_cd = cd_dir
name, git_cd = cd_dir end
end
if File.exist? "#{repo}/.git/shallow" if File.exist? "#{repo}/.git/shallow"
opoo <<~EOS opoo <<~EOS
#{name} is a shallow clone so only partial output will be shown. #{name} is a shallow clone so only partial output will be shown.
To get a full clone, run: To get a full clone, run:
git -C "#{git_cd}" fetch --unshallow git -C "#{git_cd}" fetch --unshallow
EOS EOS
end end
git_args = [] git_args = []
git_args << "--patch" if args.patch? git_args << "--patch" if args.patch?
git_args << "--stat" if args.stat? git_args << "--stat" if args.stat?
git_args << "--oneline" if args.oneline? git_args << "--oneline" if args.oneline?
git_args << "-1" if args.public_send(:"1?") git_args << "-1" if args.public_send(:"1?")
git_args << "--max-count" << args.max_count if args.max_count git_args << "--max-count" << args.max_count if args.max_count
git_args += ["--follow", "--", path] if path.present? git_args += ["--follow", "--", path] if path.present?
system "git", "log", *git_args system "git", "log", *git_args
end
end end
end end