Limit the number of commits shown in MRs

This prevents timeouts when creating a MR with 1000s of commits.
This commit is contained in:
Jacob Vosmaer 2016-03-04 15:20:30 +01:00
parent 97093a5298
commit 5eeea4b7c6

View file

@ -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