Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswaldo Ferreira <oswaldo@gitlab.com>2018-09-06 23:56:06 +0300
committerOswaldo Ferreira <oswaldo@gitlab.com>2018-09-07 01:18:27 +0300
commit965ff14b6fec206d81e2a94fceddd0eda3dfed3a (patch)
tree5ff9516012c272e3570ddbbf500a915a88a54236 /lib/gitlab/git
parentd73541d006ce3d0261cf082dac5ae605dfe7a848 (diff)
Send max_patch_bytes to Gitaly via Gitaly::CommitDiffRequest
We used to apply this limitation on GitLab when using Rugged. Now that we've shifted to Gitaly, this parameter needs to be sent via a RPC request. Currently this value is hardcoded on Gitaly.
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/diff_collection.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/gitlab/git/diff_collection.rb b/lib/gitlab/git/diff_collection.rb
index 219c69893ad..20dce8d0e06 100644
--- a/lib/gitlab/git/diff_collection.rb
+++ b/lib/gitlab/git/diff_collection.rb
@@ -11,7 +11,7 @@ module Gitlab
delegate :max_files, :max_lines, :max_bytes, :safe_max_files, :safe_max_lines, :safe_max_bytes, to: :limits
- def self.collection_limits(options = {})
+ def self.limits(options = {})
limits = {}
limits[:max_files] = options.fetch(:max_files, DEFAULT_LIMITS[:max_files])
limits[:max_lines] = options.fetch(:max_lines, DEFAULT_LIMITS[:max_lines])
@@ -19,13 +19,14 @@ module Gitlab
limits[:safe_max_files] = [limits[:max_files], DEFAULT_LIMITS[:max_files]].min
limits[:safe_max_lines] = [limits[:max_lines], DEFAULT_LIMITS[:max_lines]].min
limits[:safe_max_bytes] = limits[:safe_max_files] * 5.kilobytes # Average 5 KB per file
+ limits[:max_patch_bytes] = Gitlab::Git::Diff::SIZE_LIMIT
OpenStruct.new(limits)
end
def initialize(iterator, options = {})
@iterator = iterator
- @limits = self.class.collection_limits(options)
+ @limits = self.class.limits(options)
@enforce_limits = !!options.fetch(:limits, true)
@expanded = !!options.fetch(:expanded, true)