From 6c3361e80f4a0e7cee4b096cd9743b6081b05b69 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sun, 2 Apr 2023 01:39:23 +0800 Subject: [PATCH] install: check for `--only-dependencies` flag earlier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, doing `brew install --only-dependencies` with an unlinked formula does nothing and returns a message saying the formula is already installed but just not linked. I think that we should just install the dependencies as requested here instead of complaining that the formula isn't linked. Before: ❯ brew unlink adplug Unlinking /usr/local/Cellar/adplug/2.3.3... 8 symlinks removed. ❯ brew install --only-dependencies adplug Warning: adplug 2.3.3 is already installed, it's just not linked. To link this version, run: brew link adplug After: ❯ brew install --only-dependencies adplug ==> Fetching dependencies for adplug: libbinio ==> Fetching libbinio ==> Downloading https://ghcr.io/v2/homebrew/core/libbinio/manifests/1.5 [snip] See Homebrew/homebrew-core#127133 for additional context. --- Library/Homebrew/install.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 129d273fb0..fdf31bbe8a 100644 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -174,15 +174,15 @@ module Homebrew The currently linked version is: #{formula.linked_version} EOS end + elsif only_dependencies + msg = nil + return true elsif !formula.linked? || formula.keg_only? msg = <<~EOS #{msg}, it's just not linked. To link this version, run: brew link #{formula} EOS - elsif only_dependencies - msg = nil - return true else msg = if quiet nil