diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-08 14:50:55 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-02-08 17:40:19 +0300 |
commit | 9a99d8e49dc07faaaa2fae436423e11dab5a7d7e (patch) | |
tree | de208a478614dfc317f444969480fa56013ee809 /app/services | |
parent | 7322c5a05bc018108123194e4e542bb04d42b2b2 (diff) |
Cache various 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/services')
-rw-r--r-- | app/services/git_push_service.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb index d7ea30bc315..0f31756797d 100644 --- a/app/services/git_push_service.rb +++ b/app/services/git_push_service.rb @@ -21,8 +21,12 @@ class GitPushService project.repository.expire_cache if push_remove_branch?(ref, newrev) + project.repository.expire_has_visible_content_cache + @push_commits = [] elsif push_to_new_branch?(ref, oldrev) + project.repository.expire_has_visible_content_cache + # Re-find the pushed commits. if is_default_branch?(ref) # Initial push to the default branch. Take the full history of that branch as "newly pushed". |