Only optimize for the core tap
This commit is contained in:
parent
c787df5294
commit
2601cc410b
@ -154,14 +154,17 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if the formula has been deleted in the last month.
|
# Optimization for the core tap which has many monthly commits
|
||||||
diff_command = ["git", "diff", "--diff-filter=D", "--name-only",
|
if tap.core_tap?
|
||||||
"@{'1 month ago'}", "--", relative_path]
|
# Check if the formula has been deleted in the last month.
|
||||||
deleted_formula = Utils.popen_read(*diff_command)
|
diff_command = ["git", "diff", "--diff-filter=D", "--name-only",
|
||||||
|
"@{'1 month ago'}", "--", relative_path]
|
||||||
|
deleted_formula = Utils.popen_read(*diff_command)
|
||||||
|
|
||||||
if deleted_formula.blank?
|
if deleted_formula.blank?
|
||||||
ofail "No previously deleted formula found." unless silent
|
ofail "No previously deleted formula found." unless silent
|
||||||
return
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Find commit where formula was deleted in the last month.
|
# Find commit where formula was deleted in the last month.
|
||||||
|
|||||||
@ -75,16 +75,28 @@ describe Homebrew::MissingFormula do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a deleted formula" do
|
shared_examples "it detects deleted formulae" do
|
||||||
let(:formula) { "homebrew/foo/deleted-formula" }
|
context "with a deleted formula" do
|
||||||
|
let(:formula) { "homebrew/foo/deleted-formula" }
|
||||||
|
|
||||||
it { is_expected.not_to be_nil }
|
it { is_expected.not_to be_nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a formula that never existed" do
|
||||||
|
let(:formula) { "homebrew/foo/missing-formula" }
|
||||||
|
|
||||||
|
it { is_expected.to be_nil }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a formula that never existed" do
|
include_examples "it detects deleted formulae"
|
||||||
let(:formula) { "homebrew/foo/missing-formula" }
|
|
||||||
|
|
||||||
it { is_expected.to be_nil }
|
describe "on the core tap" do
|
||||||
|
before do
|
||||||
|
allow_any_instance_of(Tap).to receive(:core_tap?).and_return(true)
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples "it detects deleted formulae"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user