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
Léo-Paul Géneau
gitlab-ce
Commits
b012abee
Commit
b012abee
authored
Jul 06, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make all Gitaly diff flags mandatory
parent
f5b12225
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
51 deletions
+27
-51
lib/gitlab/git/diff_collection.rb
lib/gitlab/git/diff_collection.rb
+5
-7
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+1
-7
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+6
-10
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+15
-27
No files found.
lib/gitlab/git/diff_collection.rb
View file @
b012abee
...
...
@@ -42,12 +42,10 @@ module Gitlab
return
if
@overflow
return
if
@iterator
.
nil?
Gitlab
::
GitalyClient
.
migrate
(
:commit_raw_diffs
)
do
|
is_enabled
|
if
is_enabled
&&
@iterator
.
is_a?
(
Gitlab
::
GitalyClient
::
DiffStitcher
)
if
@iterator
.
is_a?
(
Gitlab
::
GitalyClient
::
DiffStitcher
)
each_gitaly_patch
(
&
block
)
else
each_rugged_patch
(
&
block
)
end
each_serialized_patch
(
&
block
)
end
@populated
=
true
...
...
@@ -118,7 +116,7 @@ module Gitlab
end
end
def
each_
rugg
ed_patch
def
each_
serializ
ed_patch
i
=
@array
.
length
@iterator
.
each
do
|
raw
|
...
...
lib/gitlab/git/repository.rb
View file @
b012abee
...
...
@@ -555,13 +555,7 @@ module Gitlab
# diff options. The +options+ hash can also include :break_rewrites to
# split larger rewrites into delete/add pairs.
def
diff
(
from
,
to
,
options
=
{},
*
paths
)
iterator
=
gitaly_migrate
(
:diff_between
)
do
|
is_enabled
|
if
is_enabled
gitaly_commit_client
.
diff
(
from
,
to
,
options
.
merge
(
paths:
paths
))
else
diff_patches
(
from
,
to
,
options
,
*
paths
)
end
end
iterator
=
gitaly_commit_client
.
diff
(
from
,
to
,
options
.
merge
(
paths:
paths
))
Gitlab
::
Git
::
DiffCollection
.
new
(
iterator
,
options
)
end
...
...
lib/gitlab/workhorse.rb
View file @
b012abee
...
...
@@ -91,16 +91,12 @@ module Gitlab
end
def
send_git_diff
(
repository
,
diff_refs
)
params
=
if
Gitlab
::
GitalyClient
.
feature_enabled?
(
:workhorse_send_git_diff
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
{
params
=
{
'GitalyServer'
=>
gitaly_server_hash
(
repository
),
'RawDiffRequest'
=>
Gitaly
::
RawDiffRequest
.
new
(
gitaly_diff_or_patch_hash
(
repository
,
diff_refs
)
).
to_json
}
else
workhorse_diff_or_patch_hash
(
repository
,
diff_refs
)
end
[
SEND_DATA_HEADER
,
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
b012abee
...
...
@@ -143,7 +143,6 @@ describe Gitlab::Workhorse do
let
(
:diff_refs
)
{
double
(
base_sha:
"base"
,
head_sha:
"head"
)
}
subject
{
described_class
.
send_git_diff
(
repository
,
diff_refs
)
}
context
'when Gitaly workhorse_send_git_diff feature is enabled'
do
it
'sets the header correctly'
do
key
,
command
,
params
=
decode_workhorse_header
(
subject
)
...
...
@@ -163,17 +162,6 @@ describe Gitlab::Workhorse do
end
end
context
'when Gitaly workhorse_send_git_diff feature is disabled'
,
:disable_gitaly
do
it
'sets the header correctly'
do
key
,
command
,
params
=
decode_workhorse_header
(
subject
)
expect
(
key
).
to
eq
(
"Gitlab-Workhorse-Send-Data"
)
expect
(
command
).
to
eq
(
"git-diff"
)
expect
(
params
).
to
eq
(
"RepoPath"
=>
repository
.
path_to_repo
,
"ShaFrom"
=>
"base"
,
"ShaTo"
=>
"head"
)
end
end
end
describe
".secret"
do
subject
{
described_class
.
secret
}
...
...
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