From d5e94f2082a64e7ebc417dd4c9e19621d3e7c63a Mon Sep 17 00:00:00 2001
From: Thierry Moisan <thierry.moisan@gmail.com>
Date: Tue, 24 Dec 2024 12:50:31 -0500
Subject: [PATCH 1/3] deps command: add --include-implicit flag

---
 Library/Homebrew/cmd/deps.rb                          | 3 +++
 Library/Homebrew/cmd/uses.rb                          | 3 +++
 Library/Homebrew/dependencies_helpers.rb              | 1 +
 Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi | 3 +++
 Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/uses.rbi | 3 +++
 5 files changed, 13 insertions(+)

diff --git a/Library/Homebrew/cmd/deps.rb b/Library/Homebrew/cmd/deps.rb
index fab09e12ac05e..a90e5d80d9d4c 100644
--- a/Library/Homebrew/cmd/deps.rb
+++ b/Library/Homebrew/cmd/deps.rb
@@ -31,6 +31,8 @@ class Deps < AbstractCommand
                description: "Show the union of dependencies for multiple <formula>, instead of the intersection."
         switch "--full-name",
                description: "List dependencies by their full name."
+        switch "--include-implicit",
+               description: "Include implicit dependencies used to download and unpack source files"
         switch "--include-build",
                description: "Include `:build` dependencies for <formula>."
         switch "--include-optional",
@@ -102,6 +104,7 @@ def run
                                       !args.tree? &&
                                       !args.graph? &&
                                       !args.HEAD? &&
+                                      !args.include_implicit? &&
                                       !args.include_build? &&
                                       !args.include_test? &&
                                       !args.include_optional? &&
diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index 5305925ffe72d..89b7be31c5e31 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -37,6 +37,8 @@ class UnavailableFormula < T::Struct
         switch "--eval-all",
                description: "Evaluate all available formulae and casks, whether installed or not, to show " \
                             "their dependents."
+        switch "--include-implicit",
+               description: "Include formulae that specify <formula> as a `:build` dependency."
         switch "--include-build",
                description: "Include formulae that specify <formula> as a `:build` dependency."
         switch "--include-test",
@@ -73,6 +75,7 @@ def run
 
         use_runtime_dependents = args.installed? &&
                                  !used_formulae_missing &&
+                                 !args.include_implicit? &&
                                  !args.include_build? &&
                                  !args.include_test? &&
                                  !args.include_optional? &&
diff --git a/Library/Homebrew/dependencies_helpers.rb b/Library/Homebrew/dependencies_helpers.rb
index ab4241484159c..0c4276f7075b0 100644
--- a/Library/Homebrew/dependencies_helpers.rb
+++ b/Library/Homebrew/dependencies_helpers.rb
@@ -11,6 +11,7 @@ module DependenciesHelpers
 
   def args_includes_ignores(args)
     includes = [:required?, :recommended?] # included by default
+    includes << :implicit? if args.include_implicit?
     includes << :build? if args.include_build?
     includes << :test? if args.include_test?
     includes << :optional? if args.include_optional?
diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi
index bb861fb4943db..def4127d1041b 100644
--- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi
+++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/deps.rbi
@@ -53,6 +53,9 @@ class Homebrew::Cmd::Deps::Args < Homebrew::CLI::Args
   sig { returns(T::Boolean) }
   def graph?; end
 
+  sig { returns(T::Boolean) }
+  def include_implicit?; end
+
   sig { returns(T::Boolean) }
   def include_build?; end
 
diff --git a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/uses.rbi b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/uses.rbi
index f73b850e32910..ddb001e3cb298 100644
--- a/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/uses.rbi
+++ b/Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/uses.rbi
@@ -26,6 +26,9 @@ class Homebrew::Cmd::Uses::Args < Homebrew::CLI::Args
   sig { returns(T::Boolean) }
   def formulae?; end
 
+  sig { returns(T::Boolean) }
+  def include_implicit?; end
+
   sig { returns(T::Boolean) }
   def include_build?; end
 

From 2af190363fb426d6978e9967c7eeaed922cf68ea Mon Sep 17 00:00:00 2001
From: Thierry Moisan <thierry.moisan@gmail.com>
Date: Fri, 27 Dec 2024 13:11:04 -0500
Subject: [PATCH 2/3] fixup! deps command: add --include-implicit flag

---
 Library/Homebrew/cmd/uses.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index 89b7be31c5e31..5e89c27a2ffc8 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -38,7 +38,8 @@ class UnavailableFormula < T::Struct
                description: "Evaluate all available formulae and casks, whether installed or not, to show " \
                             "their dependents."
         switch "--include-implicit",
-               description: "Include formulae that specify <formula> as a `:build` dependency."
+               description: "Include formulae that specify <formula> as implicit dependencies: used to " \
+                            "download and unpack source files"
         switch "--include-build",
                description: "Include formulae that specify <formula> as a `:build` dependency."
         switch "--include-test",

From c60efd943b3e32ee87b1f6bcc19a2f2f56f2dac3 Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Mon, 30 Dec 2024 12:43:20 +0000
Subject: [PATCH 3/3] cmd/uses: improve flag description.

---
 Library/Homebrew/cmd/uses.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Library/Homebrew/cmd/uses.rb b/Library/Homebrew/cmd/uses.rb
index 5e89c27a2ffc8..43b6b11880d35 100644
--- a/Library/Homebrew/cmd/uses.rb
+++ b/Library/Homebrew/cmd/uses.rb
@@ -38,7 +38,7 @@ class UnavailableFormula < T::Struct
                description: "Evaluate all available formulae and casks, whether installed or not, to show " \
                             "their dependents."
         switch "--include-implicit",
-               description: "Include formulae that specify <formula> as implicit dependencies: used to " \
+               description: "Include formulae that have <formula> as an implicit dependency to " \
                             "download and unpack source files"
         switch "--include-build",
                description: "Include formulae that specify <formula> as a `:build` dependency."