Skip to content
Snippets Groups Projects
Unverified Commit 971e4752 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Increase COMMITS_SAFE_SIZE to reasonable size in compare to diff limits. Fix...

Increase COMMITS_SAFE_SIZE to reasonable size in compare to diff limits. Fix reload with full diff link

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a7fded9b
No related branches found
No related tags found
No related merge requests found
Loading
@@ -16,9 +16,8 @@ require Rails.root.join("app/models/commit")
Loading
@@ -16,9 +16,8 @@ require Rails.root.join("app/models/commit")
class MergeRequestDiff < ActiveRecord::Base class MergeRequestDiff < ActiveRecord::Base
include Sortable include Sortable
   
# Prevent store of diff # Prevent store of diff if commits amount more then 500
# if commits amount more then 200 COMMITS_SAFE_SIZE = 500
COMMITS_SAFE_SIZE = 200
   
attr_reader :commits, :diffs attr_reader :commits, :diffs
   
Loading
@@ -124,12 +123,12 @@ class MergeRequestDiff < ActiveRecord::Base
Loading
@@ -124,12 +123,12 @@ class MergeRequestDiff < ActiveRecord::Base
if new_diffs.any? if new_diffs.any?
if new_diffs.size > Commit::DIFF_HARD_LIMIT_FILES if new_diffs.size > Commit::DIFF_HARD_LIMIT_FILES
self.state = :overflow_diff_files_limit self.state = :overflow_diff_files_limit
new_diffs = [] new_diffs = new_diffs.first[Commit::DIFF_HARD_LIMIT_LINES]
end end
   
if new_diffs.sum { |diff| diff.diff.lines.count } > Commit::DIFF_HARD_LIMIT_LINES if new_diffs.sum { |diff| diff.diff.lines.count } > Commit::DIFF_HARD_LIMIT_LINES
self.state = :overflow_diff_lines_limit self.state = :overflow_diff_lines_limit
new_diffs = [] new_diffs = new_diffs.first[Commit::DIFF_HARD_LIMIT_LINES]
end end
end end
   
Loading
Loading
Loading
@@ -3,7 +3,7 @@
Loading
@@ -3,7 +3,7 @@
Too many changes to show. Too many changes to show.
.pull-right .pull-right
- unless diff_hard_limit_enabled? - unless diff_hard_limit_enabled?
= link_to "Reload with full diff", url_for(params.merge(force_show_diff: true)), class: "btn btn-sm btn-warning" = link_to "Reload with full diff", url_for(params.merge(force_show_diff: true, format: nil)), class: "btn btn-sm btn-warning"
   
- if current_controller?(:commit) or current_controller?(:merge_requests) - if current_controller?(:commit) or current_controller?(:merge_requests)
- if current_controller?(:commit) - if current_controller?(:commit)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment