summaryrefslogtreecommitdiff
path: root/app/models/repository.rb
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-02-16 17:31:37 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2016-02-17 11:38:18 +0100
commita9e0301c230a81242d476f30d7089565919214b3 (patch)
tree42ef1c550a463f32a330050b6a4e0985246a004e /app/models/repository.rb
parent300e16065a4fca95ff04de96d31e34f57cf9a4a4 (diff)
downloadgitlab-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.rb8
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