From e234fb7542195f7a6e656708d17b0d0c1935d739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?fn=20=E2=8C=83=20=E2=8C=A5?= <70830482+FnControlOption@users.noreply.github.com> Date: Mon, 2 Jan 2023 14:10:17 -0800 Subject: [PATCH] formula_installer: check if dependencies have already been fetched. Given a `pkg_a` that depends on `pkg_b`, it is redundant to list `pkg_b` as a dependency when running the following commands: - `brew install pkg_b pkg_a` - `brew upgrade` (when both `pkg_a` and `pkg_b` are outdated) --- Library/Homebrew/formula_installer.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index b4eba15ae2..fe2ef1402a 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -1156,7 +1156,10 @@ class FormulaInstaller def fetch_dependencies return if ignore_deps? - deps = compute_dependencies + deps = compute_dependencies.reject do |dep, _options| + self.class.fetched.include?(dep.to_formula) + end + return if deps.empty? oh1 "Fetching dependencies for #{formula.full_name}: " \