diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-16 17:31:37 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-17 11:38:18 +0100 |
commit | a9e0301c230a81242d476f30d7089565919214b3 (patch) | |
tree | 42ef1c550a463f32a330050b6a4e0985246a004e /app/models/repository.rb | |
parent | 300e16065a4fca95ff04de96d31e34f57cf9a4a4 (diff) | |
download | gitlab-ce-a9e0301c230a81242d476f30d7089565919214b3.tar.gz |
Expire caches after forking/importing a repository
This ensures the caches for Repository#empty? and
Repository#has_visible_content? are flushed after a repository has been
imported or forked.
Fixes gitlab-org/gitlab-ce#13505
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index ba275fd9803..5696504e7ec 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -258,6 +258,14 @@ class Repository @root_ref = nil end + # Expires the cache(s) used to determine if a repository is empty or not. + def expire_emptiness_caches + cache.expire(:empty?) + @empty = nil + + expire_has_visible_content_cache + end + def expire_has_visible_content_cache cache.expire(:has_visible_content?) @has_visible_content = nil |