summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-04 15:20:30 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-04 15:20:30 +0100
commit5eeea4b7c69d29e8e8371b3c63f25938dcca7bb6 (patch)
treeb87fb9023595b61aef0e7ef9dc5daf8aea37dea2
parent97093a52984f1f4682b5d3432f7666f3c806c4ca (diff)
downloadgitlab-ce-5eeea4b7c69d29e8e8371b3c63f25938dcca7bb6.tar.gz
Limit the number of commits shown in MRs
This prevents timeouts when creating a MR with 1000s of commits.
-rw-r--r--app/views/projects/commits/_commits.html.haml12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/views/projects/commits/_commits.html.haml b/app/views/projects/commits/_commits.html.haml
index 6c631228002..e708b2df540 100644
--- a/app/views/projects/commits/_commits.html.haml
+++ b/app/views/projects/commits/_commits.html.haml
@@ -1,7 +1,13 @@
- unless defined?(project)
- project = @project
+- if @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
+ - commits = @commits.first(MergeRequestDiff::COMMITS_SAFE_SIZE)
+ - overflow = true
+- else
+ - commits = @commits
+ - overflow = false
-- @commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits|
+- commits.group_by { |c| c.committed_date.to_date }.sort.reverse.each do |day, commits|
.row.commits-row
.col-md-2.hidden-xs.hidden-sm
%h5.commits-row-date
@@ -13,3 +19,7 @@
%ul.bordered-list
= render commits, project: project
%hr.lists-separator
+
+- if overflow
+ .alert.alert-warning
+ Not shown: #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} more commits