Cache Repository#root_ref within a request
When an empty project is loaded in the UI, there are 15 separate Gitaly
FindDefaultBranch
calls to determine the root_ref. Previously, it was not
cached even within the request. This change caches it within the request
so only a single FindDefaultBranch
RPC is needed.
The calls come from:
- 6 from anchor data: https://gitlab.com/gitlab-org/gitlab-ce/blob/6fc43e6f17bcb17f9754c571bf4fadd603abe82b/app/presenters/project_presenter.rb#L55-60
- 6 from
can_current_user_push_to_default_branch?
from the anchor data calls - 3 from
can_current_user_push_to_default_branch?
inapp/views/projects/empty.html.haml
Edited by Stan Hu