Merge pull request #3614 from MikeMcQuaid/previously-deleted-month

missing_formula: check deleted in the last month.
This commit is contained in:
Mike McQuaid 2017-12-31 09:42:36 +00:00 committed by GitHub
commit e048106624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -122,7 +122,7 @@ module Homebrew
tap.path.cd do tap.path.cd do
unless silent unless silent
ohai "Searching for a previously deleted formula..." ohai "Searching for a previously deleted formula (in the last month)..."
if (tap.path/".git/shallow").exist? if (tap.path/".git/shallow").exist?
opoo <<~EOS opoo <<~EOS
#{tap} is shallow clone. To get complete history run: #{tap} is shallow clone. To get complete history run:
@ -132,7 +132,7 @@ module Homebrew
end end
end end
log_command = "git log --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}" log_command = "git log --since='1 month ago' --diff-filter=D --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}"
hash, short_hash, *commit_message, relative_path = hash, short_hash, *commit_message, relative_path =
Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp) Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp)

View File

@ -140,6 +140,8 @@ describe Homebrew::MissingFormula do
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo" tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
tap_path.mkpath tap_path.mkpath
(tap_path/"deleted-formula.rb").write "placeholder" (tap_path/"deleted-formula.rb").write "placeholder"
ENV.delete "GIT_AUTHOR_DATE"
ENV.delete "GIT_COMMITTER_DATE"
tap_path.cd do tap_path.cd do
system "git", "init" system "git", "init"