Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
20d415a6
Commit
20d415a6
authored
Apr 07, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitlab::Git::Repository#gitaly_... more
parent
6474c67d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
21 deletions
+17
-21
lib/api/internal.rb
lib/api/internal.rb
+1
-1
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-2
lib/gitlab/gitaly_client/notifications.rb
lib/gitlab/gitaly_client/notifications.rb
+5
-5
lib/gitlab/gitaly_client/ref.rb
lib/gitlab/gitaly_client/ref.rb
+7
-7
lib/gitlab/gitaly_client/util.rb
lib/gitlab/gitaly_client/util.rb
+0
-4
spec/lib/gitlab/gitaly_client/notifications_spec.rb
spec/lib/gitlab/gitaly_client/notifications_spec.rb
+1
-1
spec/lib/gitlab/gitaly_client/ref_spec.rb
spec/lib/gitlab/gitaly_client/ref_spec.rb
+1
-1
No files found.
lib/api/internal.rb
View file @
20d415a6
...
@@ -142,7 +142,7 @@ module API
...
@@ -142,7 +142,7 @@ module API
project
=
Project
.
find_by_full_path
(
relative_path
.
sub
(
/\.(git|wiki)\z/
,
''
))
project
=
Project
.
find_by_full_path
(
relative_path
.
sub
(
/\.(git|wiki)\z/
,
''
))
begin
begin
Gitlab
::
GitalyClient
::
Notifications
.
new
(
project
.
repository
_storage
,
relative_path
).
post_receive
Gitlab
::
GitalyClient
::
Notifications
.
new
(
project
.
repository
).
post_receive
rescue
GRPC
::
Unavailable
=>
e
rescue
GRPC
::
Unavailable
=>
e
render_api_error
(
e
,
500
)
render_api_error
(
e
,
500
)
end
end
...
...
lib/gitlab/git/repository.rb
View file @
20d415a6
...
@@ -973,7 +973,7 @@ module Gitlab
...
@@ -973,7 +973,7 @@ module Gitlab
end
end
def
gitaly_channel
def
gitaly_channel
Gitlab
::
GitalyClient
::
Util
.
channel
(
@repository_storage
)
Gitlab
::
GitalyClient
.
get_
channel
(
@repository_storage
)
end
end
private
private
...
@@ -1255,7 +1255,7 @@ module Gitlab
...
@@ -1255,7 +1255,7 @@ module Gitlab
end
end
def
gitaly_ref_client
def
gitaly_ref_client
@gitaly_ref_client
||=
Gitlab
::
GitalyClient
::
Ref
.
new
(
@repository_storage
,
@relative_path
)
@gitaly_ref_client
||=
Gitlab
::
GitalyClient
::
Ref
.
new
(
self
)
end
end
end
end
end
end
...
...
lib/gitlab/gitaly_client/notifications.rb
View file @
20d415a6
...
@@ -3,14 +3,14 @@ module Gitlab
...
@@ -3,14 +3,14 @@ module Gitlab
class
Notifications
class
Notifications
attr_accessor
:stub
attr_accessor
:stub
def
initialize
(
repository_storage
,
relative_path
)
# 'repository' is a Gitlab::Git::Repository
@channel
=
Util
.
channel
(
repository_storage
)
def
initialize
(
repository
)
@
repository
=
Util
.
repository
(
repository_storage
,
relative_path
)
@
gitaly_repo
=
repository
.
gitaly_repository
@stub
=
Gitaly
::
Notifications
::
Stub
.
new
(
nil
,
nil
,
channel_override:
@
channel
)
@stub
=
Gitaly
::
Notifications
::
Stub
.
new
(
nil
,
nil
,
channel_override:
repository
.
gitaly_
channel
)
end
end
def
post_receive
def
post_receive
request
=
Gitaly
::
PostReceiveRequest
.
new
(
repository:
@
repository
)
request
=
Gitaly
::
PostReceiveRequest
.
new
(
repository:
@
gitaly_repo
)
@stub
.
post_receive
(
request
)
@stub
.
post_receive
(
request
)
end
end
end
end
...
...
lib/gitlab/gitaly_client/ref.rb
View file @
20d415a6
...
@@ -3,24 +3,24 @@ module Gitlab
...
@@ -3,24 +3,24 @@ module Gitlab
class
Ref
class
Ref
attr_accessor
:stub
attr_accessor
:stub
def
initialize
(
repository_storage
,
relative_path
)
# 'repository' is a Gitlab::Git::Repository
@channel
=
Util
.
channel
(
repository_storage
)
def
initialize
(
repository
)
@
repository
=
Util
.
repository
(
repository_storage
,
relative_path
)
@
gitaly_repo
=
repository
.
gitaly_repository
@stub
=
Gitaly
::
Ref
::
Stub
.
new
(
nil
,
nil
,
channel_override:
@
channel
)
@stub
=
Gitaly
::
Ref
::
Stub
.
new
(
nil
,
nil
,
channel_override:
repository
.
gitaly_
channel
)
end
end
def
default_branch_name
def
default_branch_name
request
=
Gitaly
::
FindDefaultBranchNameRequest
.
new
(
repository:
@
repository
)
request
=
Gitaly
::
FindDefaultBranchNameRequest
.
new
(
repository:
@
gitaly_repo
)
stub
.
find_default_branch_name
(
request
).
name
.
gsub
(
/^refs\/heads\//
,
''
)
stub
.
find_default_branch_name
(
request
).
name
.
gsub
(
/^refs\/heads\//
,
''
)
end
end
def
branch_names
def
branch_names
request
=
Gitaly
::
FindAllBranchNamesRequest
.
new
(
repository:
@
repository
)
request
=
Gitaly
::
FindAllBranchNamesRequest
.
new
(
repository:
@
gitaly_repo
)
consume_refs_response
(
stub
.
find_all_branch_names
(
request
),
prefix:
'refs/heads/'
)
consume_refs_response
(
stub
.
find_all_branch_names
(
request
),
prefix:
'refs/heads/'
)
end
end
def
tag_names
def
tag_names
request
=
Gitaly
::
FindAllTagNamesRequest
.
new
(
repository:
@
repository
)
request
=
Gitaly
::
FindAllTagNamesRequest
.
new
(
repository:
@
gitaly_repo
)
consume_refs_response
(
stub
.
find_all_tag_names
(
request
),
prefix:
'refs/tags/'
)
consume_refs_response
(
stub
.
find_all_tag_names
(
request
),
prefix:
'refs/tags/'
)
end
end
...
...
lib/gitlab/gitaly_client/util.rb
View file @
20d415a6
...
@@ -9,10 +9,6 @@ module Gitlab
...
@@ -9,10 +9,6 @@ module Gitlab
relative_path:
relative_path
,
relative_path:
relative_path
,
)
)
end
end
def
channel
(
repository_storage
)
GitalyClient
.
get_channel
(
repository_storage
)
end
end
end
end
end
end
end
...
...
spec/lib/gitlab/gitaly_client/notifications_spec.rb
View file @
20d415a6
...
@@ -4,7 +4,7 @@ describe Gitlab::GitalyClient::Notifications do
...
@@ -4,7 +4,7 @@ describe Gitlab::GitalyClient::Notifications do
describe
'#post_receive'
do
describe
'#post_receive'
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:repo_path
)
{
project
.
repository
.
path_to_repo
}
let
(
:repo_path
)
{
project
.
repository
.
path_to_repo
}
subject
{
described_class
.
new
(
project
.
repository
_storage
,
project
.
full_path
+
'.git'
)
}
subject
{
described_class
.
new
(
project
.
repository
)
}
it
'sends a post_receive message'
do
it
'sends a post_receive message'
do
expect_any_instance_of
(
Gitaly
::
Notifications
::
Stub
).
expect_any_instance_of
(
Gitaly
::
Notifications
::
Stub
).
...
...
spec/lib/gitlab/gitaly_client/ref_spec.rb
View file @
20d415a6
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
GitalyClient
::
Ref
do
describe
Gitlab
::
GitalyClient
::
Ref
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:repo_path
)
{
project
.
repository
.
path_to_repo
}
let
(
:repo_path
)
{
project
.
repository
.
path_to_repo
}
let
(
:client
)
{
Gitlab
::
GitalyClient
::
Ref
.
new
(
project
.
repository
_storage
,
project
.
full_path
+
'.git'
)
}
let
(
:client
)
{
Gitlab
::
GitalyClient
::
Ref
.
new
(
project
.
repository
)
}
before
do
before
do
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:enabled
).
and_return
(
true
)
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:enabled
).
and_return
(
true
)
...
...
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