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
2671dd85
Commit
2671dd85
authored
Apr 06, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rely on #overflow? for determining oversized MR
parent
b4c07c00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
ee/lib/gitlab/code_owners.rb
ee/lib/gitlab/code_owners.rb
+7
-1
ee/spec/lib/gitlab/code_owners_spec.rb
ee/spec/lib/gitlab/code_owners_spec.rb
+2
-2
No files found.
ee/lib/gitlab/code_owners.rb
View file @
2671dd85
...
@@ -41,7 +41,7 @@ module Gitlab
...
@@ -41,7 +41,7 @@ module Gitlab
# the MUCH slower method of using Repository#diff_stats, which isn't
# the MUCH slower method of using Repository#diff_stats, which isn't
# subject to the same limit.
# subject to the same limit.
#
#
if
merge_request
.
diff_size
==
"1000+"
if
oversized_merge_request?
(
merge_request
,
merge_request_diff
)
slow_path_lookup
(
merge_request
,
merge_request_diff
)
slow_path_lookup
(
merge_request
,
merge_request_diff
)
else
else
fast_path_lookup
(
merge_request
,
merge_request_diff
)
fast_path_lookup
(
merge_request
,
merge_request_diff
)
...
@@ -49,6 +49,12 @@ module Gitlab
...
@@ -49,6 +49,12 @@ module Gitlab
end
end
private_class_method
:paths_for_merge_request
private_class_method
:paths_for_merge_request
def
self
.
oversized_merge_request?
(
merge_request
,
merge_request_diff
)
mrd_to_check_for_overflow
=
merge_request_diff
||
merge_request
.
merge_request_diff
mrd_to_check_for_overflow
.
overflow?
end
def
self
.
slow_path_lookup
(
merge_request
,
merge_request_diff
)
def
self
.
slow_path_lookup
(
merge_request
,
merge_request_diff
)
merge_request_diff
=
merge_request_diff
||
merge_request
.
merge_request_diff
merge_request_diff
=
merge_request_diff
||
merge_request
.
merge_request_diff
...
...
ee/spec/lib/gitlab/code_owners_spec.rb
View file @
2671dd85
...
@@ -64,7 +64,7 @@ describe Gitlab::CodeOwners do
...
@@ -64,7 +64,7 @@ describe Gitlab::CodeOwners do
it
"return equivalent results"
do
it
"return equivalent results"
do
fast_results
=
described_class
.
entries_for_merge_request
(
merge_request
).
first
fast_results
=
described_class
.
entries_for_merge_request
(
merge_request
).
first
expect
(
merge_request
).
to
receive
(
:diff_size
).
and_return
(
"1000+"
)
expect
(
merge_request
.
merge_request_diff
).
to
receive
(
:overflow?
).
and_return
(
true
)
slow_results
=
described_class
.
entries_for_merge_request
(
merge_request
).
first
slow_results
=
described_class
.
entries_for_merge_request
(
merge_request
).
first
...
@@ -113,7 +113,7 @@ describe Gitlab::CodeOwners do
...
@@ -113,7 +113,7 @@ describe Gitlab::CodeOwners do
context
'when the merge request is large (>1_000 files)'
do
context
'when the merge request is large (>1_000 files)'
do
before
do
before
do
expect
(
merge_request
).
to
receive
(
:diff_size
).
and_return
(
"1000+"
)
expect
(
merge_request
.
merge_request_diff
).
to
receive
(
:overflow?
).
and_return
(
true
)
end
end
it
'generates paths via .slow_path_lookup'
do
it
'generates paths via .slow_path_lookup'
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