diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2017-09-29 16:08:44 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-09-29 16:08:44 +0300 |
commit | 403712f06e776d7c2d97dd094fe55871a3137b8a (patch) | |
tree | fc25e813807b57248deea7a348881569aaaaad88 /lib/gitlab/gitaly_client | |
parent | f43d94a6302a699c47749d9abe2287baf942e423 (diff) |
Make Repository#has_visible_content more efficient
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r-- | lib/gitlab/gitaly_client/ref_service.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/gitaly_client/ref_service.rb b/lib/gitlab/gitaly_client/ref_service.rb index b0c73395cb1..8214b7d63fa 100644 --- a/lib/gitlab/gitaly_client/ref_service.rb +++ b/lib/gitlab/gitaly_client/ref_service.rb @@ -57,6 +57,14 @@ module Gitlab branch_names.count end + # TODO implement a more efficient RPC for this https://gitlab.com/gitlab-org/gitaly/issues/616 + def has_local_branches? + request = Gitaly::FindAllBranchNamesRequest.new(repository: @gitaly_repo) + response = GitalyClient.call(@storage, :ref_service, :find_all_branch_names, request).first + + response&.names.present? + end + def local_branches(sort_by: nil) request = Gitaly::FindLocalBranchesRequest.new(repository: @gitaly_repo) request.sort_by = sort_by_param(sort_by) if sort_by |