Merge pull request #11475 from Rylan12/fix-eligible_kegs_for_cleanup

formula: reject only the latest head keg when cleaning up
This commit is contained in:
Rylan Polster 2021-06-01 11:12:52 -04:00 committed by GitHub
commit b8479ade2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -2179,10 +2179,10 @@ class Formula
def eligible_kegs_for_cleanup(quiet: false)
eligible_for_cleanup = []
if latest_version_installed?
eligible_kegs = if head?
eligible_kegs = if head? && (head_prefix = latest_head_prefix)
head, stable = installed_kegs.partition { |k| k.version.head? }
# Remove newest head and stable kegs
head.sort_by(&:version).slice(0...-1) + stable.sort_by(&:version).slice(0...-1)
head - [Keg.new(head_prefix)] + stable.sort_by(&:version).slice(0...-1)
else
installed_kegs.select do |keg|
tab = Tab.for_keg(keg)

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BREW" "1" "May 2021" "Homebrew" "brew"
.TH "BREW" "1" "June 2021" "Homebrew" "brew"
.
.SH "NAME"
\fBbrew\fR \- The Missing Package Manager for macOS (or Linux)