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
Boxiang Sun
gitlab-ce
Commits
13487809
Commit
13487809
authored
Mar 30, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass Gitaly Repository messages to workhorse
parent
88812ce2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
3 deletions
+17
-3
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+10
-2
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+7
-1
No files found.
lib/gitlab/workhorse.rb
View file @
13487809
...
@@ -17,14 +17,22 @@ module Gitlab
...
@@ -17,14 +17,22 @@ module Gitlab
class
<<
self
class
<<
self
def
git_http_ok
(
repository
,
user
)
def
git_http_ok
(
repository
,
user
)
repo_path
=
repository
.
path_to_repo
params
=
{
params
=
{
GL_ID
:
Gitlab
::
GlId
.
gl_id
(
user
),
GL_ID
:
Gitlab
::
GlId
.
gl_id
(
user
),
RepoPath
:
repo
sitory
.
path_to_repo
,
RepoPath
:
repo
_path
,
}
}
if
Gitlab
.
config
.
gitaly
.
enabled
if
Gitlab
.
config
.
gitaly
.
enabled
address
=
Gitlab
::
GitalyClient
.
get_address
(
repository
.
project
.
repository_storage
)
storage
=
repository
.
project
.
repository_storage
address
=
Gitlab
::
GitalyClient
.
get_address
(
storage
)
params
[
:GitalySocketPath
]
=
URI
(
address
).
path
params
[
:GitalySocketPath
]
=
URI
(
address
).
path
# TODO: use GitalyClient code to assemble the Repository message
params
[
:Repository
]
=
Gitaly
::
Repository
.
new
(
path:
repo_path
,
storage_name:
storage
,
relative_path:
Gitlab
::
RepoPath
.
strip_storage_path
(
repo_path
),
).
to_h
end
end
params
params
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
13487809
...
@@ -179,10 +179,11 @@ describe Gitlab::Workhorse, lib: true do
...
@@ -179,10 +179,11 @@ describe Gitlab::Workhorse, lib: true do
describe
'.git_http_ok'
do
describe
'.git_http_ok'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:repo_path
)
{
repository
.
path_to_repo
}
subject
{
described_class
.
git_http_ok
(
repository
,
user
)
}
subject
{
described_class
.
git_http_ok
(
repository
,
user
)
}
it
{
expect
(
subject
).
to
eq
({
GL_ID
:
"user-
#{
user
.
id
}
"
,
RepoPath
:
repo
sitory
.
path_to_repo
})
}
it
{
expect
(
subject
).
to
eq
({
GL_ID
:
"user-
#{
user
.
id
}
"
,
RepoPath
:
repo
_path
})
}
context
'when Gitaly is enabled'
do
context
'when Gitaly is enabled'
do
before
do
before
do
...
@@ -192,6 +193,11 @@ describe Gitlab::Workhorse, lib: true do
...
@@ -192,6 +193,11 @@ describe Gitlab::Workhorse, lib: true do
it
'includes Gitaly params in the returned value'
do
it
'includes Gitaly params in the returned value'
do
gitaly_socket_path
=
URI
(
Gitlab
::
GitalyClient
.
get_address
(
'default'
)).
path
gitaly_socket_path
=
URI
(
Gitlab
::
GitalyClient
.
get_address
(
'default'
)).
path
expect
(
subject
).
to
include
({
GitalySocketPath
:
gitaly_socket_path
})
expect
(
subject
).
to
include
({
GitalySocketPath
:
gitaly_socket_path
})
expect
(
subject
[
:Repository
]).
to
include
({
path:
repo_path
,
storage_name:
'default'
,
relative_path:
project
.
full_path
+
'.git'
,
})
end
end
end
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