diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-08 12:50:55 +0100 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-08 15:40:19 +0100 |
commit | 9a99d8e49dc07faaaa2fae436423e11dab5a7d7e (patch) | |
tree | de208a478614dfc317f444969480fa56013ee809 /app/models/project.rb | |
parent | 7322c5a05bc018108123194e4e542bb04d42b2b2 (diff) | |
download | gitlab-ce-caching-repository-git-operations.tar.gz |
Cache various Repository Git operationscaching-repository-git-operations
This caches the output of the following methods:
* Repository#empty?
* Repository#has_visible_content?
* Repository#root_ref
The cache for Repository#has_visible_content? is flushed whenever a
commit is pushed to a new branch or an existing branch is removed.
The cache for Repository#root_ref is only flushed whenever a user
changes the default branch of a project. The cache for Repository#empty?
is never explicitly flushed as there's no need for it.
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 043f08b9a13..f11c6d7c6be 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -790,6 +790,8 @@ class Project < ActiveRecord::Base def change_head(branch) # Cached divergent commit counts are based on repository head repository.expire_branch_cache + repository.expire_root_ref_cache + gitlab_shell.update_repository_head(self.path_with_namespace, branch) reload_default_branch end |