BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
06e7eeb1
Commit
06e7eeb1
authored
Oct 08, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitaly's RepositoryService.HasLocalBranches RPC
parent
9ac5338b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
9 deletions
+19
-9
repository.rb
lib/gitlab/git/repository.rb
+1
-1
ref_service.rb
lib/gitlab/gitaly_client/ref_service.rb
+0
-8
repository_service.rb
lib/gitlab/gitaly_client/repository_service.rb
+7
-0
repository_service_spec.rb
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
+11
-0
No files found.
lib/gitlab/git/repository.rb
View file @
06e7eeb1
...
...
@@ -193,7 +193,7 @@ module Gitlab
def
has_local_branches?
gitaly_migrate
(
:has_local_branches
)
do
|
is_enabled
|
if
is_enabled
gitaly_re
f
_client
.
has_local_branches?
gitaly_re
pository
_client
.
has_local_branches?
else
has_local_branches_rugged?
end
...
...
lib/gitlab/gitaly_client/ref_service.rb
View file @
06e7eeb1
...
...
@@ -57,14 +57,6 @@ 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
...
...
lib/gitlab/gitaly_client/repository_service.rb
View file @
06e7eeb1
...
...
@@ -58,6 +58,13 @@ module Gitlab
request
=
Gitaly
::
CreateRepositoryRequest
.
new
(
repository:
@gitaly_repo
)
GitalyClient
.
call
(
@storage
,
:repository_service
,
:create_repository
,
request
)
end
def
has_local_branches?
request
=
Gitaly
::
HasLocalBranchesRequest
.
new
(
repository:
@gitaly_repo
)
response
=
GitalyClient
.
call
(
@storage
,
:repository_service
,
:has_local_branches
,
request
)
response
.
value
end
end
end
end
spec/lib/gitlab/gitaly_client/repository_service_spec.rb
View file @
06e7eeb1
...
...
@@ -73,4 +73,15 @@ describe Gitlab::GitalyClient::RepositoryService do
client
.
apply_gitattributes
(
revision
)
end
end
describe
'#has_local_branches?'
do
it
'sends a has_local_branches message'
do
expect_any_instance_of
(
Gitaly
::
RepositoryService
::
Stub
)
.
to
receive
(
:has_local_branches
)
.
with
(
gitaly_request_with_path
(
storage_name
,
relative_path
),
kind_of
(
Hash
))
.
and_return
(
double
(
value:
true
))
expect
(
client
.
has_local_branches?
).
to
be
(
true
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment