Fix Error 500 in creating merge requests with > 1000 diffs

Closes #2692
This commit is contained in:
Stan Hu 2015-09-25 02:39:34 -07:00
parent 718817fd8f
commit a44ca15c1d
2 changed files with 3 additions and 2 deletions

View File

@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 8.1.0 (unreleased)
- Fix Error 500 in creating merge requests with > 1000 diffs (Stan Hu)
- Show CI status on all pages where commits list is rendered
- Automatically enable CI when push .gitlab-ci.yml file to repository
- Move CI charts to project graphs area

View File

@ -123,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.first[Commit::DIFF_HARD_LIMIT_LINES]
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.first[Commit::DIFF_HARD_LIMIT_LINES]
new_diffs = new_diffs.first(Commit::DIFF_HARD_LIMIT_LINES)
end
end