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
Jérome Perrin
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
Hide 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
project
=
Project
.
find_by_full_path
(
relative_path
.
sub
(
/\.(git|wiki)\z/
,
''
))
begin
Gitlab
::
GitalyClient
::
Notifications
.
new
(
project
.
repository
_storage
,
relative_path
).
post_receive
Gitlab
::
GitalyClient
::
Notifications
.
new
(
project
.
repository
).
post_receive
rescue
GRPC
::
Unavailable
=>
e
render_api_error
(
e
,
500
)
end
...
...
lib/gitlab/git/repository.rb
View file @
20d415a6
...
...
@@ -973,7 +973,7 @@ module Gitlab
end
def
gitaly_channel
Gitlab
::
GitalyClient
::
Util
.
channel
(
@repository_storage
)
Gitlab
::
GitalyClient
.
get_
channel
(
@repository_storage
)
end
private
...
...
@@ -1255,7 +1255,7 @@ module Gitlab
end
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
...
...
lib/gitlab/gitaly_client/notifications.rb
View file @
20d415a6
...
...
@@ -3,14 +3,14 @@ module Gitlab
class
Notifications
attr_accessor
:stub
def
initialize
(
repository_storage
,
relative_path
)
@channel
=
Util
.
channel
(
repository_storage
)
@
repository
=
Util
.
repository
(
repository_storage
,
relative_path
)
@stub
=
Gitaly
::
Notifications
::
Stub
.
new
(
nil
,
nil
,
channel_override:
@
channel
)
# 'repository' is a Gitlab::Git::Repository
def
initialize
(
repository
)
@
gitaly_repo
=
repository
.
gitaly_repository
@stub
=
Gitaly
::
Notifications
::
Stub
.
new
(
nil
,
nil
,
channel_override:
repository
.
gitaly_
channel
)
end
def
post_receive
request
=
Gitaly
::
PostReceiveRequest
.
new
(
repository:
@
repository
)
request
=
Gitaly
::
PostReceiveRequest
.
new
(
repository:
@
gitaly_repo
)
@stub
.
post_receive
(
request
)
end
end
...
...
lib/gitlab/gitaly_client/ref.rb
View file @
20d415a6
...
...
@@ -3,24 +3,24 @@ module Gitlab
class
Ref
attr_accessor
:stub
def
initialize
(
repository_storage
,
relative_path
)
@channel
=
Util
.
channel
(
repository_storage
)
@
repository
=
Util
.
repository
(
repository_storage
,
relative_path
)
@stub
=
Gitaly
::
Ref
::
Stub
.
new
(
nil
,
nil
,
channel_override:
@
channel
)
# 'repository' is a Gitlab::Git::Repository
def
initialize
(
repository
)
@
gitaly_repo
=
repository
.
gitaly_repository
@stub
=
Gitaly
::
Ref
::
Stub
.
new
(
nil
,
nil
,
channel_override:
repository
.
gitaly_
channel
)
end
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\//
,
''
)
end
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/'
)
end
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/'
)
end
...
...
lib/gitlab/gitaly_client/util.rb
View file @
20d415a6
...
...
@@ -9,10 +9,6 @@ module Gitlab
relative_path:
relative_path
,
)
end
def
channel
(
repository_storage
)
GitalyClient
.
get_channel
(
repository_storage
)
end
end
end
end
...
...
spec/lib/gitlab/gitaly_client/notifications_spec.rb
View file @
20d415a6
...
...
@@ -4,7 +4,7 @@ describe Gitlab::GitalyClient::Notifications do
describe
'#post_receive'
do
let
(
:project
)
{
create
(
:empty_project
)
}
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
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'
describe
Gitlab
::
GitalyClient
::
Ref
do
let
(
:project
)
{
create
(
:empty_project
)
}
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
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