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
e4ac948c
Commit
e4ac948c
authored
Apr 06, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send more Gitaly::Repository fields
parent
9216f59a
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
26 deletions
+40
-26
app/models/repository.rb
app/models/repository.rb
+3
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+8
-0
lib/gitlab/gitaly_client/commit.rb
lib/gitlab/gitaly_client/commit.rb
+7
-10
lib/gitlab/gitaly_client/notifications.rb
lib/gitlab/gitaly_client/notifications.rb
+2
-1
lib/gitlab/gitaly_client/ref.rb
lib/gitlab/gitaly_client/ref.rb
+2
-1
lib/gitlab/gitaly_client/util.rb
lib/gitlab/gitaly_client/util.rb
+15
-5
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+2
-8
spec/lib/gitlab/gitaly_client/commit_spec.rb
spec/lib/gitlab/gitaly_client/commit_spec.rb
+1
-1
No files found.
app/models/repository.rb
View file @
e4ac948c
...
...
@@ -1156,6 +1156,9 @@ class Repository
@project
.
repository_storage_path
end
delegate
:gitaly_repository
,
to: :raw_repository
delegate
:gitaly_channel
,
to: :raw_repository
def
initialize_raw_repository
Gitlab
::
Git
::
Repository
.
new
(
project
.
repository_storage
,
path_with_namespace
+
'.git'
)
end
...
...
lib/gitlab/git/repository.rb
View file @
e4ac948c
...
...
@@ -968,6 +968,14 @@ module Gitlab
@attributes
.
attributes
(
path
)
end
def
gitaly_repository
Gitlab
::
GitalyClient
::
Util
.
repository
(
@repository_storage
,
@relative_path
)
end
def
gitaly_channel
Gitlab
::
GitalyClient
::
Util
.
channel
(
@repository_storage
)
end
private
# Get the content of a blob for a given commit. If the blob is a commit
...
...
lib/gitlab/gitaly_client/commit.rb
View file @
e4ac948c
...
...
@@ -7,14 +7,13 @@ module Gitlab
class
<<
self
def
diff_from_parent
(
commit
,
options
=
{})
project
=
commit
.
project
channel
=
GitalyClient
.
get_channel
(
project
.
repository_storage
)
stub
=
Gitaly
::
Diff
::
Stub
.
new
(
nil
,
nil
,
channel_override:
channel
)
repo
=
Gitaly
::
Repository
.
new
(
path:
project
.
repository
.
path_to_repo
)
repository
=
commit
.
project
.
repository
gitaly_repo
=
repository
.
gitaly_repository
stub
=
Gitaly
::
Diff
::
Stub
.
new
(
nil
,
nil
,
channel_override:
repository
.
gitaly_channel
)
parent
=
commit
.
parents
[
0
]
parent_id
=
parent
?
parent
.
id
:
EMPTY_TREE_ID
request
=
Gitaly
::
CommitDiffRequest
.
new
(
repository:
repo
,
repository:
gitaly_
repo
,
left_commit_id:
parent_id
,
right_commit_id:
commit
.
id
)
...
...
@@ -23,12 +22,10 @@ module Gitlab
end
def
is_ancestor
(
repository
,
ancestor_id
,
child_id
)
project
=
Project
.
find_by_path
(
repository
.
path
)
channel
=
GitalyClient
.
get_channel
(
project
.
repository_storage
)
stub
=
Gitaly
::
Commit
::
Stub
.
new
(
nil
,
nil
,
channel_override:
channel
)
repo
=
Gitaly
::
Repository
.
new
(
path:
repository
.
path_to_repo
)
gitaly_repo
=
repository
.
gitaly_repository
stub
=
Gitaly
::
Commit
::
Stub
.
new
(
nil
,
nil
,
channel_override:
repository
.
gitaly_channel
)
request
=
Gitaly
::
CommitIsAncestorRequest
.
new
(
repository:
repo
,
repository:
gitaly_
repo
,
ancestor_id:
ancestor_id
,
child_id:
child_id
)
...
...
lib/gitlab/gitaly_client/notifications.rb
View file @
e4ac948c
...
...
@@ -4,7 +4,8 @@ module Gitlab
attr_accessor
:stub
def
initialize
(
repository_storage
,
relative_path
)
@channel
,
@repository
=
Util
.
process_path
(
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
)
end
...
...
lib/gitlab/gitaly_client/ref.rb
View file @
e4ac948c
...
...
@@ -4,7 +4,8 @@ module Gitlab
attr_accessor
:stub
def
initialize
(
repository_storage
,
relative_path
)
@channel
,
@repository
=
Util
.
process_path
(
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
)
end
...
...
lib/gitlab/gitaly_client/util.rb
View file @
e4ac948c
module
Gitlab
module
GitalyClient
module
Util
def
self
.
process_path
(
repository_storage
,
relative_path
)
channel
=
GitalyClient
.
get_channel
(
repository_storage
)
storage_path
=
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
][
'path'
]
repository
=
Gitaly
::
Repository
.
new
(
path:
File
.
join
(
storage_path
,
relative_path
))
class
<<
self
def
self
.
process_path
(
repository_storage
,
relative_path
)
[
channel
(
repository_storage
),
repository
(
repository_storage
,
relative_path
)
]
end
[
channel
,
repository
]
def
repository
(
repository_storage
,
relative_path
)
Gitaly
::
Repository
.
new
(
path:
File
.
join
(
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
][
'path'
],
relative_path
),
storage_name:
repository_storage
,
relative_path:
relative_path
,
)
end
def
channel
(
repository_storage
)
GitalyClient
.
get_channel
(
repository_storage
)
end
end
end
end
...
...
lib/gitlab/workhorse.rb
View file @
e4ac948c
...
...
@@ -24,14 +24,8 @@ module Gitlab
}
if
Gitlab
.
config
.
gitaly
.
enabled
storage
=
repository
.
project
.
repository_storage
address
=
Gitlab
::
GitalyClient
.
get_address
(
storage
)
# 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
address
=
Gitlab
::
GitalyClient
.
get_address
(
repository
.
project
.
repository_storage
)
params
[
:Repository
]
=
repository
.
gitaly_repository
.
to_h
feature_enabled
=
case
action
.
to_s
when
'git_receive_pack'
...
...
spec/lib/gitlab/gitaly_client/commit_spec.rb
View file @
e4ac948c
...
...
@@ -4,7 +4,7 @@ describe Gitlab::GitalyClient::Commit do
describe
'.diff_from_parent'
do
let
(
:diff_stub
)
{
double
(
'Gitaly::Diff::Stub'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
)
}
let
(
:repository_message
)
{
Gitaly
::
Repository
.
new
(
path:
project
.
repository
.
path
)
}
let
(
:repository_message
)
{
project
.
repository
.
gitaly_repository
}
let
(
:commit
)
{
project
.
commit
(
'913c66a37b4a45b9769037c55c2d238bd0942d2e'
)
}
before
do
...
...
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