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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
27fb64d6
Commit
27fb64d6
authored
May 11, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deltas_only from DiffCollection
parent
f737a079
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
32 deletions
+5
-32
app/models/commit.rb
app/models/commit.rb
+1
-4
lib/gitlab/git/diff_collection.rb
lib/gitlab/git/diff_collection.rb
+0
-11
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+4
-17
No files found.
app/models/commit.rb
View file @
27fb64d6
...
...
@@ -326,10 +326,7 @@ class Commit
end
def
raw_diffs
(
*
args
)
use_gitaly
=
Gitlab
::
GitalyClient
.
feature_enabled?
(
:commit_raw_diffs
)
deltas_only
=
args
.
last
.
is_a?
(
Hash
)
&&
args
.
last
[
:deltas_only
]
if
use_gitaly
&&
!
deltas_only
if
Gitlab
::
GitalyClient
.
feature_enabled?
(
:commit_raw_diffs
)
Gitlab
::
GitalyClient
::
Commit
.
diff_from_parent
(
self
,
*
args
)
else
raw
.
diffs
(
*
args
)
...
...
lib/gitlab/git/diff_collection.rb
View file @
27fb64d6
...
...
@@ -15,7 +15,6 @@ module Gitlab
@safe_max_bytes
=
@safe_max_files
*
5120
# Average 5 KB per file
@all_diffs
=
!!
options
.
fetch
(
:all_diffs
,
false
)
@no_collapse
=
!!
options
.
fetch
(
:no_collapse
,
true
)
@deltas_only
=
!!
options
.
fetch
(
:deltas_only
,
false
)
@line_count
=
0
@byte_count
=
0
...
...
@@ -27,8 +26,6 @@ module Gitlab
if
@populated
# @iterator.each is slower than just iterating the array in place
@array
.
each
(
&
block
)
elsif
@deltas_only
each_delta
(
&
block
)
else
Gitlab
::
GitalyClient
.
migrate
(
:commit_raw_diffs
)
do
each_patch
(
&
block
)
...
...
@@ -81,14 +78,6 @@ module Gitlab
files
>=
@safe_max_files
||
@line_count
>
@safe_max_lines
||
@byte_count
>=
@safe_max_bytes
end
def
each_delta
@iterator
.
each_delta
.
with_index
do
|
delta
,
i
|
diff
=
Gitlab
::
Git
::
Diff
.
new
(
delta
)
yield
@array
[
i
]
=
diff
end
end
def
each_patch
@iterator
.
each_with_index
do
|
raw
,
i
|
# First yield cached Diff instances from @array
...
...
spec/models/commit_spec.rb
View file @
27fb64d6
...
...
@@ -395,7 +395,6 @@ eos
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
with
(
:commit_raw_diffs
).
and_return
(
true
)
end
context
'when a truthy deltas_only is not passed to args'
do
it
'fetches diffs from Gitaly server'
do
expect
(
Gitlab
::
GitalyClient
::
Commit
).
to
receive
(
:diff_from_parent
).
with
(
commit
)
...
...
@@ -403,17 +402,5 @@ eos
commit
.
raw_diffs
end
end
context
'when a truthy deltas_only is passed to args'
do
it
'fetches diffs using Rugged'
do
opts
=
{
deltas_only:
true
}
expect
(
Gitlab
::
GitalyClient
::
Commit
).
not_to
receive
(
:diff_from_parent
)
expect
(
commit
.
raw
).
to
receive
(
:diffs
).
with
(
opts
)
commit
.
raw_diffs
(
opts
)
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