diff --git a/Library/Homebrew/dev-cmd/audit.rb b/Library/Homebrew/dev-cmd/audit.rb index 1917476d46..7e5129a9fd 100644 --- a/Library/Homebrew/dev-cmd/audit.rb +++ b/Library/Homebrew/dev-cmd/audit.rb @@ -886,7 +886,8 @@ module Homebrew end end - if previous_version != newest_committed_version && + if (previous_version != newest_committed_version || + current_version != newest_committed_version) && !current_revision.zero? && current_revision == newest_committed_revision && current_revision == previous_revision diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index c0895c2db0..fc6feb77bb 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -727,6 +727,12 @@ module Homebrew it { is_expected.to match("'revision 2' should be removed") } end + context "should be removed with a newer local version" do + before { formula_gsub "foo-1.0.tar.gz", "foo-1.1.tar.gz" } + + it { is_expected.to match("'revision 2' should be removed") } + end + context "should not warn on an newer version revision removal" do before do formula_gsub_origin_commit "revision 2", ""