summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-31 14:41:25 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-31 14:41:25 -0500
commit04cf618b6ff943527938f64a451a420b494b5a76 (patch)
tree115e9f7bae89e2a1eba453560cbe6ccb551693ba /lib
parentce869e3964a40b4cf04a803f5201d940ad61b13c (diff)
downloadgitlab-ce-04cf618b6ff943527938f64a451a420b494b5a76.tar.gz
Change no_limits to limitsdm-collapsed-blob
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commits.rb2
-rw-r--r--lib/api/entities.rb6
-rw-r--r--lib/api/v3/commits.rb2
-rw-r--r--lib/api/v3/entities.rb2
-rw-r--r--lib/gitlab/git/diff.rb2
-rw-r--r--lib/gitlab/git/diff_collection.rb8
6 files changed, 11 insertions, 11 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb
index 904993d1606..c6fc17cc391 100644
--- a/lib/api/commits.rb
+++ b/lib/api/commits.rb
@@ -176,7 +176,7 @@ module API
}
if params[:path]
- commit.raw_diffs(no_limits: true).each do |diff|
+ commit.raw_diffs(limits: false).each do |diff|
next unless diff.new_path == params[:path]
lines = Gitlab::Diff::Parser.new.parse(diff.diff.each_line)
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index 9799fe68a76..5032bab77b7 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -331,7 +331,7 @@ module API
class MergeRequestChanges < MergeRequest
expose :diffs, as: :changes, using: Entities::RepoDiff do |compare, _|
- compare.raw_diffs(no_limits: true).to_a
+ compare.raw_diffs(limits: false).to_a
end
end
@@ -344,7 +344,7 @@ module API
expose :commits, using: Entities::RepoCommit
expose :diffs, using: Entities::RepoDiff do |compare, _|
- compare.raw_diffs(no_limits: true).to_a
+ compare.raw_diffs(limits: false).to_a
end
end
@@ -548,7 +548,7 @@ module API
end
expose :diffs, using: Entities::RepoDiff do |compare, options|
- compare.diffs(no_limits: true).to_a
+ compare.diffs(limits: false).to_a
end
expose :compare_timeout do |compare, options|
diff --git a/lib/api/v3/commits.rb b/lib/api/v3/commits.rb
index ec6c6c7b298..5936f4700aa 100644
--- a/lib/api/v3/commits.rb
+++ b/lib/api/v3/commits.rb
@@ -167,7 +167,7 @@ module API
}
if params[:path]
- commit.raw_diffs(no_limits: true).each do |diff|
+ commit.raw_diffs(limits: false).each do |diff|
next unless diff.new_path == params[:path]
lines = Gitlab::Diff::Parser.new.parse(diff.diff.each_line)
diff --git a/lib/api/v3/entities.rb b/lib/api/v3/entities.rb
index 7fbd4949850..7c5065dee90 100644
--- a/lib/api/v3/entities.rb
+++ b/lib/api/v3/entities.rb
@@ -226,7 +226,7 @@ module API
class MergeRequestChanges < MergeRequest
expose :diffs, as: :changes, using: ::API::Entities::RepoDiff do |compare, _|
- compare.raw_diffs(no_limits: true).to_a
+ compare.raw_diffs(limits: false).to_a
end
end
diff --git a/lib/gitlab/git/diff.rb b/lib/gitlab/git/diff.rb
index 2462f766f17..ccccca96595 100644
--- a/lib/gitlab/git/diff.rb
+++ b/lib/gitlab/git/diff.rb
@@ -155,7 +155,7 @@ module Gitlab
:include_untracked_content, :skip_binary_check,
:include_typechange, :include_typechange_trees,
:ignore_filemode, :recurse_ignored_dirs, :paths,
- :max_files, :max_lines, :no_limits, :expanded]
+ :max_files, :max_lines, :limits, :expanded]
if default_options
actual_defaults = default_options.dup
diff --git a/lib/gitlab/git/diff_collection.rb b/lib/gitlab/git/diff_collection.rb
index 9b217b9080d..334e06a6eca 100644
--- a/lib/gitlab/git/diff_collection.rb
+++ b/lib/gitlab/git/diff_collection.rb
@@ -13,7 +13,7 @@ module Gitlab
@safe_max_files = [@max_files, DEFAULT_LIMITS[:max_files]].min
@safe_max_lines = [@max_lines, DEFAULT_LIMITS[:max_lines]].min
@safe_max_bytes = @safe_max_files * 5.kilobytes # Average 5 KB per file
- @no_limits = !!options.fetch(:no_limits, false)
+ @enforce_limits = !!options.fetch(:limits, true)
@expanded = !!options.fetch(:expanded, true)
@line_count = 0
@@ -88,12 +88,12 @@ module Gitlab
@iterator.each do |raw|
@empty = false
- if !@no_limits && i >= @max_files
+ if @enforce_limits && i >= @max_files
@overflow = true
break
end
- expanded = @no_limits || @expanded
+ expanded = !@enforce_limits || @expanded
diff = Gitlab::Git::Diff.new(raw, expanded: expanded)
@@ -104,7 +104,7 @@ module Gitlab
@line_count += diff.line_count
@byte_count += diff.diff.bytesize
- if !@no_limits && (@line_count >= @max_lines || @byte_count >= @max_bytes)
+ if @enforce_limits && (@line_count >= @max_lines || @byte_count >= @max_bytes)
# This last Diff instance pushes us over the lines limit. We stop and
# discard it.
@overflow = true