diff options
| author | Mike McQuaid | 2017-03-22 21:56:15 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2017-03-23 08:39:29 +0000 |
| commit | 4c2fe5d91ea8802584473ab1d05d04b3ec86ae72 (patch) | |
| tree | c60f0e2b89aa5df6b3f12538d27184379275033a | |
| parent | c458ffbd241340e97a60ca0d90e8094bbb45df69 (diff) | |
| download | brew-4c2fe5d91ea8802584473ab1d05d04b3ec86ae72.tar.bz2 | |
missing_formula: print immediately when searching git log.
| -rw-r--r-- | Library/Homebrew/missing_formula.rb | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/Library/Homebrew/missing_formula.rb b/Library/Homebrew/missing_formula.rb index 8defa86ab..9c1656aa2 100644 --- a/Library/Homebrew/missing_formula.rb +++ b/Library/Homebrew/missing_formula.rb @@ -5,8 +5,9 @@ require "utils" module Homebrew module MissingFormula class << self - def reason(name) - blacklisted_reason(name) || tap_migration_reason(name) || deleted_reason(name) + def reason(name, silent: false) + blacklisted_reason(name) || tap_migration_reason(name) || + deleted_reason(name, silent: silent) end def blacklisted_reason(name) @@ -117,7 +118,7 @@ module Homebrew message end - def deleted_reason(name) + def deleted_reason(name, silent: false) path = Formulary.path name return if File.exist? path tap = Tap.from_path(path) @@ -125,25 +126,17 @@ module Homebrew relative_path = path.relative_path_from tap.path tap.path.cd do - begin - timer_pid = fork do - # Let the user know what's going on when the search goes on for - # more than two seconds. - sleep 2 - opoo "Searching through git history. This may take a while..." - end - - # We know this may return incomplete results for shallow clones but - # we don't want to nag everyone with a shallow clone to unshallow it. - log_command = "git log --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}" - hash, short_hash, *commit_message, relative_path = - Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) - ensure - Process.kill "TERM", timer_pid - end + ohai "Searching for a previously deleted formula..." unless silent + + # We know this may return incomplete results for shallow clones but + # we don't want to nag everyone with a shallow clone to unshallow it. + log_command = "git log --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}" + hash, short_hash, *commit_message, relative_path = + Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) if hash.to_s.empty? || short_hash.to_s.empty? || relative_path.to_s.empty? + ofail "No previously deleted formula found." unless silent return end |
