diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-16 16:32:43 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-07-16 16:32:43 +0200 |
commit | 971e47520f176625efe9c6c0dace7c6325ad89e5 (patch) | |
tree | c770a9c974885129fbd0aa4c93c3c05e43e5c611 /app/models/merge_request_diff.rb | |
parent | a7fded9b9529cfc08463afd4f6cf12478262e951 (diff) | |
download | gitlab-ce-971e47520f176625efe9c6c0dace7c6325ad89e5.tar.gz |
Increase COMMITS_SAFE_SIZE to reasonable size in compare to diff limits. Fix reload with full diff link
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/merge_request_diff.rb')
-rw-r--r-- | app/models/merge_request_diff.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index 6f01a589d1c..2177f972ca3 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -16,9 +16,8 @@ require Rails.root.join("app/models/commit") class MergeRequestDiff < ActiveRecord::Base include Sortable - # Prevent store of diff - # if commits amount more then 200 - COMMITS_SAFE_SIZE = 200 + # Prevent store of diff if commits amount more then 500 + COMMITS_SAFE_SIZE = 500 attr_reader :commits, :diffs @@ -124,12 +123,12 @@ class MergeRequestDiff < ActiveRecord::Base if new_diffs.any? if new_diffs.size > Commit::DIFF_HARD_LIMIT_FILES self.state = :overflow_diff_files_limit - new_diffs = [] + new_diffs = new_diffs.first[Commit::DIFF_HARD_LIMIT_LINES] end if new_diffs.sum { |diff| diff.diff.lines.count } > Commit::DIFF_HARD_LIMIT_LINES self.state = :overflow_diff_lines_limit - new_diffs = [] + new_diffs = new_diffs.first[Commit::DIFF_HARD_LIMIT_LINES] end end |