Merge pull request #4614 from reitermarkus/fix-cleanup

Fix cleanup for files with `--`.
This commit is contained in:
Markus Reiter 2018-08-06 17:13:49 +02:00 committed by GitHub
commit 54a9f687df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ module Homebrew
version = file.version
end
next unless version
next unless (name = file.basename.to_s[/(.*)-(?:#{Regexp.escape(version)})/, 1])
next unless (name = file.basename.to_s[/\A(.*?)\-\-?(?:#{Regexp.escape(version)})/, 1])
next unless HOMEBREW_CELLAR.directory?

View File

@ -226,8 +226,8 @@ describe Homebrew::Cleanup do
end
context "cleans old files in HOMEBREW_CACHE" do
let(:bottle) { (HOMEBREW_CACHE/"testball-0.0.1.bottle.tar.gz") }
let(:testball) { (HOMEBREW_CACHE/"testball-0.0.1") }
let(:bottle) { (HOMEBREW_CACHE/"testball--0.0.1.bottle.tar.gz") }
let(:testball) { (HOMEBREW_CACHE/"testball--0.0.1") }
before do
FileUtils.touch(bottle)