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
16f85003
Commit
16f85003
authored
Sep 20, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populate `Gitlay::Repository`'s `gl_repository` field
parent
a97ff8aa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+48
-3
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+1
-1
lib/gitlab/gitaly_client/util.rb
lib/gitlab/gitaly_client/util.rb
+2
-1
spec/lib/gitlab/gitaly_client/util_spec.rb
spec/lib/gitlab/gitaly_client/util_spec.rb
+43
-0
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+2
-1
No files found.
lib/gitlab/git/repository.rb
View file @
16f85003
...
@@ -1062,7 +1062,7 @@ module Gitlab
...
@@ -1062,7 +1062,7 @@ module Gitlab
end
end
def
gitaly_repository
def
gitaly_repository
Gitlab
::
GitalyClient
::
Util
.
repository
(
@storage
,
@relative_path
)
Gitlab
::
GitalyClient
::
Util
.
repository
(
@storage
,
@relative_path
,
@gl_repository
)
end
end
def
gitaly_operations_client
def
gitaly_operations_client
...
...
lib/gitlab/gitaly_client/util.rb
View file @
16f85003
...
@@ -2,10 +2,11 @@ module Gitlab
...
@@ -2,10 +2,11 @@ module Gitlab
module
GitalyClient
module
GitalyClient
module
Util
module
Util
class
<<
self
class
<<
self
def
repository
(
repository_storage
,
relative_path
)
def
repository
(
repository_storage
,
relative_path
,
gl_repository
)
Gitaly
::
Repository
.
new
(
Gitaly
::
Repository
.
new
(
storage_name:
repository_storage
,
storage_name:
repository_storage
,
relative_path:
relative_path
,
relative_path:
relative_path
,
gl_repository:
gl_repository
,
git_object_directory:
Gitlab
::
Git
::
Env
[
'GIT_OBJECT_DIRECTORY'
].
to_s
,
git_object_directory:
Gitlab
::
Git
::
Env
[
'GIT_OBJECT_DIRECTORY'
].
to_s
,
git_alternate_object_directories:
Array
.
wrap
(
Gitlab
::
Git
::
Env
[
'GIT_ALTERNATE_OBJECT_DIRECTORIES'
])
git_alternate_object_directories:
Array
.
wrap
(
Gitlab
::
Git
::
Env
[
'GIT_ALTERNATE_OBJECT_DIRECTORIES'
])
)
)
...
...
spec/lib/gitlab/gitaly_client/util_spec.rb
0 → 100644
View file @
16f85003
require
'spec_helper'
describe
Gitlab
::
GitalyClient
::
Util
do
describe
'.repository'
do
let
(
:repository_storage
)
{
'default'
}
let
(
:relative_path
)
{
'my/repo.git'
}
let
(
:gl_repository
)
{
'project-1'
}
let
(
:git_object_directory
)
{
'.git/objects'
}
let
(
:git_alternate_object_directory
)
{
'/dir/one:/dir/two'
}
subject
do
described_class
.
repository
(
repository_storage
,
relative_path
,
gl_repository
)
end
it
'creates a Gitaly::Repository with the given data'
do
expect
(
Gitlab
::
Git
::
Env
).
to
receive
(
:[]
).
with
(
'GIT_OBJECT_DIRECTORY'
)
.
and_return
(
git_object_directory
)
expect
(
Gitlab
::
Git
::
Env
).
to
receive
(
:[]
).
with
(
'GIT_ALTERNATE_OBJECT_DIRECTORIES'
)
.
and_return
(
git_alternate_object_directory
)
expect
(
subject
).
to
be_a
(
Gitaly
::
Repository
)
expect
(
subject
.
storage_name
).
to
eq
(
repository_storage
)
expect
(
subject
.
relative_path
).
to
eq
(
relative_path
)
expect
(
subject
.
gl_repository
).
to
eq
(
gl_repository
)
expect
(
subject
.
git_object_directory
).
to
eq
(
git_object_directory
)
expect
(
subject
.
git_alternate_object_directories
).
to
eq
([
git_alternate_object_directory
])
end
end
describe
'.gitaly_user'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:gl_id
)
{
Gitlab
::
GlId
.
gl_id
(
user
)
}
subject
{
described_class
.
gitaly_user
(
user
)
}
it
'creates a Gitaly::User from a GitLab user'
do
expect
(
subject
).
to
be_a
(
Gitaly
::
User
)
expect
(
subject
.
name
).
to
eq
(
user
.
name
)
expect
(
subject
.
email
).
to
eq
(
user
.
email
)
expect
(
subject
.
gl_id
).
to
eq
(
gl_id
)
end
end
end
spec/lib/gitlab/workhorse_spec.rb
View file @
16f85003
...
@@ -216,7 +216,8 @@ describe Gitlab::Workhorse do
...
@@ -216,7 +216,8 @@ describe Gitlab::Workhorse do
it
'includes a Repository param'
do
it
'includes a Repository param'
do
repo_param
=
{
repo_param
=
{
storage_name:
'default'
,
storage_name:
'default'
,
relative_path:
project
.
full_path
+
'.git'
relative_path:
project
.
full_path
+
'.git'
,
gl_repository:
"project-
#{
project
.
id
}
"
}
}
expect
(
subject
[
:Repository
]).
to
include
(
repo_param
)
expect
(
subject
[
:Repository
]).
to
include
(
repo_param
)
...
...
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