Commit 8e344aef authored by Marc Shaw's avatar Marc Shaw

Increase the soft limits for a merge request

Issue: gitlab.com/gitlab-org/gitlab/-/issues/219565
Merge Request: gitlab.com/gitlab-org/gitlab/-/merge_requests/43123
parent 568940df
......@@ -74,8 +74,8 @@ class Commit
sha[0..MIN_SHA_LENGTH]
end
def diff_safe_lines
Gitlab::Git::DiffCollection.default_limits[:max_lines]
def diff_safe_lines(project: nil)
Gitlab::Git::DiffCollection.default_limits(project: project)[:max_lines]
end
def diff_hard_limit_files(project: nil)
......
- too_big = diff_file.diff_lines.count > Commit.diff_safe_lines
- too_big = diff_file.diff_lines.count > Commit.diff_safe_lines(project: @project)
- if too_big
.suppressed-container
%a.show-suppressed-diff.cursor-pointer.js-show-suppressed-diff= _("Changes suppressed. Click to show.")
......
......@@ -66,7 +66,9 @@ module Gitlab
end
def merged_diff_options(diff_options)
max_diff_options = ::Commit.max_diff_options(project: @merge_request_diff.project)
project = @merge_request_diff.project
max_diff_options = ::Commit.max_diff_options(project: project).merge(project: project)
diff_options.present? ? diff_options.merge(max_diff_options) : max_diff_options
end
end
......
......@@ -11,13 +11,17 @@ module Gitlab
delegate :max_files, :max_lines, :max_bytes, :safe_max_files, :safe_max_lines, :safe_max_bytes, to: :limits
def self.default_limits
def self.default_limits(project: nil)
if Feature.enabled?(:increased_diff_limits, project)
{ max_files: 200, max_lines: 7500 }
else
{ max_files: 100, max_lines: 5000 }
end
end
def self.limits(options = {})
limits = {}
defaults = default_limits
defaults = default_limits(project: options[:project])
limits[:max_files] = options.fetch(:max_files, defaults[:max_files])
limits[:max_lines] = options.fetch(:max_lines, defaults[:max_lines])
limits[:max_bytes] = limits[:max_files] * 5.kilobytes # Average 5 KB per file
......
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