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.push ")"
# This is a false positive type error: https://github.com/sorbet/sorbet/issues/6812
T.unsafe(self).cd HOMEBREW_PREFIX
safe_system "find", *arguments
cd(HOMEBREW_PREFIX) { safe_system("find", *arguments) }
end
end

View File

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