diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-20 16:23:54 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-20 20:17:50 +0100 |
commit | e0cb3212edd12068c1083fd3c6911c9d560f34b7 (patch) | |
tree | 17dbce2fb6fce943c6483257186321d4bf89ffc8 /app/models/repository.rb | |
parent | 040ae7e3e0c6f4d97fe6366bff9b05831283db7e (diff) | |
download | gitlab-ce-e0cb3212edd12068c1083fd3c6911c9d560f34b7.tar.gz |
Flush emptiness caches whenever needed
This ensures that the emptiness cache (used for Repository#empty? and
Repository#has_visible_content?) is flushed after comitting changes
(using the web editor, API or Git) for new repositories. Once a
repository is no longer empty there's no need to explicitly flush the
cache for Repository#empty?. The cache for
Repository#has_visible_content? in turn is already flushed whenever
needed.
Fixes gitlab-org/gitlab-ce#13387
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index be30a3b0906..e050bd45254 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -239,6 +239,10 @@ class Repository end expire_branch_cache(branch_name) + + # This ensures this particular cache is flushed after the first commit to a + # new repository. + expire_emptiness_caches if empty? end # Expires _all_ caches, including those that would normally only be expired |