Commit 2671dd85 authored by Kerri Miller's avatar Kerri Miller

Rely on #overflow? for determining oversized MR

parent b4c07c00
......@@ -41,7 +41,7 @@ module Gitlab
# the MUCH slower method of using Repository#diff_stats, which isn't
# 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)
else
fast_path_lookup(merge_request, merge_request_diff)
......@@ -49,6 +49,12 @@ module Gitlab
end
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)
merge_request_diff = merge_request_diff || merge_request.merge_request_diff
......
......@@ -64,7 +64,7 @@ describe Gitlab::CodeOwners do
it "return equivalent results" do
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
......@@ -113,7 +113,7 @@ describe Gitlab::CodeOwners do
context 'when the merge request is large (>1_000 files)' 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
it 'generates paths via .slow_path_lookup' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment