Commit 5eeea4b7 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Limit the number of commits shown in MRs

This prevents timeouts when creating a MR with 1000s of commits.
parent 97093a52
- unless defined?(project) - unless defined?(project)
- project = @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 .row.commits-row
.col-md-2.hidden-xs.hidden-sm .col-md-2.hidden-xs.hidden-sm
%h5.commits-row-date %h5.commits-row-date
...@@ -13,3 +19,7 @@ ...@@ -13,3 +19,7 @@
%ul.bordered-list %ul.bordered-list
= render commits, project: project = render commits, project: project
%hr.lists-separator %hr.lists-separator
- if overflow
.alert.alert-warning
Not shown: #{@commits.size - MergeRequestDiff::COMMITS_SAFE_SIZE} more commits
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment