aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tab.rb
diff options
context:
space:
mode:
authorAlyssa Ross2016-11-15 17:44:02 +0000
committerAlyssa Ross2016-11-17 14:26:00 +0000
commit8bfc205a878fb154185e07253f539ec503fc808f (patch)
tree65a80ece45bd74a50635123a5682e1d439fe15dc /Library/Homebrew/tab.rb
parente6933b90dc750dc9aadb3bfb6acf1bf395942d57 (diff)
downloadbrew-8bfc205a878fb154185e07253f539ec503fc808f.tar.bz2
tab: clear Formula.installed cache when created.
This was causing the flaky tests that #1508 started skipping. This is the second time that `Formula.installed`'s cache has bitten me with intermittent test failures, and I'd like it to be the last, so I've made it so the cache is cleared automatically when a tab is created. This _should_ mean that the cache is cleared any time it needs to be, with the exception of when a Keg is created artificially with no tab. I don't think there's anything I can do to automatically handle that use-case, though.
Diffstat (limited to 'Library/Homebrew/tab.rb')
-rw-r--r--Library/Homebrew/tab.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 1cabacefd..6b274b143 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -317,6 +317,10 @@ class Tab < OpenStruct
end
def write
+ # If this is a new installation, the cache of installed formulae
+ # will no longer be valid.
+ Formula.clear_cache unless tabfile.exist?
+
CACHE[tabfile] = self
tabfile.atomic_write(to_json)
end