diff options
author | Stan Hu <stanhu@gmail.com> | 2015-09-25 12:39:34 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-09-29 05:44:53 +0300 |
commit | 9683d1ef1f245ba3f270e4139b6146ce5d5bc8ac (patch) | |
tree | 898c5214409c2239a690854647d4c75a1542ed52 | |
parent | 1c8c7b3738691893876810c3b2768ecc7e8353be (diff) |
Fix Error 500 in creating merge requests with > 1000 diffs
Closes #2692
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/merge_request_diff.rb | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG index ac94b809842..baa4cebb61e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.0.3 - Fix URL shown in Slack notifications - Fix bug where projects would appear to be stuck in the forked import state (Stan Hu) + - Fix Error 500 in creating merge requests with > 1000 diffs (Stan Hu) v 8.0.2 - Fix default avatar not rendering in network graph (Stan Hu) diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index e317c8eac4d..f75f999b0d0 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -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 |