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
258d5a50
Commit
258d5a50
authored
Aug 09, 2017
by
Alejandro Rodríguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incorporate DiffService.CommitPatch Gitaly RPC
parent
8936a92e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
5 deletions
+46
-5
GITALY_SERVER_VERSION
GITALY_SERVER_VERSION
+1
-1
Gemfile
Gemfile
+1
-1
Gemfile.lock
Gemfile.lock
+2
-2
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+7
-1
lib/gitlab/gitaly_client/commit_service.rb
lib/gitlab/gitaly_client/commit_service.rb
+10
-0
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+25
-0
No files found.
GITALY_SERVER_VERSION
View file @
258d5a50
0.3
2
.0
0.3
3
.0
Gemfile
View file @
258d5a50
...
@@ -401,7 +401,7 @@ group :ed25519 do
...
@@ -401,7 +401,7 @@ group :ed25519 do
end
end
# Gitaly GRPC client
# Gitaly GRPC client
gem
'
gitaly
'
,
'~> 0.
29
.0'
gem
'
gitaly
'
,
'~> 0.
30
.0'
gem
'
toml-rb
'
,
'~> 0.3.15'
,
require:
false
gem
'
toml-rb
'
,
'~> 0.3.15'
,
require:
false
...
...
Gemfile.lock
View file @
258d5a50
...
@@ -275,7 +275,7 @@ GEM
...
@@ -275,7 +275,7 @@ GEM
po_to_json (>= 1.0.0)
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
rails (>= 3.2.0)
gherkin-ruby (0.3.2)
gherkin-ruby (0.3.2)
gitaly (0.
29
.0)
gitaly (0.
30
.0)
google-protobuf (~> 3.1)
google-protobuf (~> 3.1)
grpc (~> 1.0)
grpc (~> 1.0)
github-linguist (4.7.6)
github-linguist (4.7.6)
...
@@ -1019,7 +1019,7 @@ DEPENDENCIES
...
@@ -1019,7 +1019,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.2.0)
gettext_i18n_rails_js (~> 1.2.0)
gitaly (~> 0.
29
.0)
gitaly (~> 0.
30
.0)
github-linguist (~> 4.7.0)
github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-markup (~> 1.5.1)
gitlab-markup (~> 1.5.1)
...
...
lib/gitlab/git/commit.rb
View file @
258d5a50
...
@@ -271,7 +271,13 @@ module Gitlab
...
@@ -271,7 +271,13 @@ module Gitlab
#
#
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/324
# Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/324
def
to_diff
def
to_diff
rugged_diff_from_parent
.
patch
Gitlab
::
GitalyClient
.
migrate
(
:commit_patch
)
do
|
is_enabled
|
if
is_enabled
@repository
.
gitaly_commit_client
.
patch
(
id
)
else
rugged_diff_from_parent
.
patch
end
end
end
end
# Returns a diff object for the changes from this commit's first parent.
# Returns a diff object for the changes from this commit's first parent.
...
...
lib/gitlab/gitaly_client/commit_service.rb
View file @
258d5a50
...
@@ -194,6 +194,16 @@ module Gitlab
...
@@ -194,6 +194,16 @@ module Gitlab
response
.
commit
response
.
commit
end
end
def
patch
(
revision
)
request
=
Gitaly
::
CommitPatchRequest
.
new
(
repository:
@gitaly_repo
,
revision:
GitalyClient
.
encode
(
revision
)
)
response
=
GitalyClient
.
call
(
@repository
.
storage
,
:diff_service
,
:commit_patch
,
request
)
response
.
sum
(
&
:data
)
end
private
private
def
commit_diff_request_params
(
commit
,
options
=
{})
def
commit_diff_request_params
(
commit
,
options
=
{})
...
...
spec/lib/gitlab/gitaly_client/commit_service_spec.rb
View file @
258d5a50
...
@@ -126,4 +126,29 @@ describe Gitlab::GitalyClient::CommitService do
...
@@ -126,4 +126,29 @@ describe Gitlab::GitalyClient::CommitService do
described_class
.
new
(
repository
).
find_commit
(
revision
)
described_class
.
new
(
repository
).
find_commit
(
revision
)
end
end
end
end
describe
'#patch'
do
let
(
:request
)
do
Gitaly
::
CommitPatchRequest
.
new
(
repository:
repository_message
,
revision:
revision
)
end
let
(
:response
)
{
[
double
(
data:
"my "
),
double
(
data:
"diff"
)]
}
subject
{
described_class
.
new
(
repository
).
patch
(
revision
)
}
it
'sends an RPC request'
do
expect_any_instance_of
(
Gitaly
::
DiffService
::
Stub
).
to
receive
(
:commit_patch
)
.
with
(
request
,
kind_of
(
Hash
)).
and_return
([])
subject
end
it
'concatenates the responses data'
do
allow_any_instance_of
(
Gitaly
::
DiffService
::
Stub
).
to
receive
(
:commit_patch
)
.
with
(
request
,
kind_of
(
Hash
)).
and_return
(
response
)
expect
(
subject
).
to
eq
(
"my diff"
)
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