Commit 8f88cbf06bce7e88b9a4470645665b65ca543946

Authored by Dmitriy Zaporozhets
1 parent 68249f23

Use MergeRequestDiff::COMMITS_SAFE_SIZE for Compare diff limit.

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/controllers/projects/compare_controller.rb
@@ -8,7 +8,7 @@ class Projects::CompareController &lt; Projects::ApplicationController @@ -8,7 +8,7 @@ class Projects::CompareController &lt; Projects::ApplicationController
8 end 8 end
9 9
10 def show 10 def show
11 - compare = Gitlab::Git::Compare.new(@repository.raw_repository, params[:from], params[:to]) 11 + compare = Gitlab::Git::Compare.new(@repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE)
12 12
13 @commits = compare.commits 13 @commits = compare.commits
14 @commit = compare.commit 14 @commit = compare.commit
app/views/projects/compare/_form.html.haml
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 &nbsp; 14 &nbsp;
15 = submit_tag "Compare", class: "btn btn-create commits-compare-btn" 15 = submit_tag "Compare", class: "btn btn-create commits-compare-btn"
16 - if compare_to_mr_button? 16 - if compare_to_mr_button?
17 - = link_to compare_mr_path, class: 'prepend-left-10' do 17 + = link_to compare_mr_path, class: 'prepend-left-10 btn' do
18 %strong Make a merge request 18 %strong Make a merge request
19 19
20 20
app/views/projects/compare/show.html.haml
@@ -5,12 +5,6 @@ @@ -5,12 +5,6 @@
5 5
6 = render "form" 6 = render "form"
7 7
8 -- if @commits.size > 100  
9 - .alert.alert-warning  
10 - %p  
11 - %strong Warning! This comparison includes more than 100 commits.  
12 - %p To preserve performance the line diff is not shown.  
13 -  
14 - if @commits.present? 8 - if @commits.present?
15 %div.ui-box 9 %div.ui-box
16 .title 10 .title
@@ -24,9 +18,15 @@ @@ -24,9 +18,15 @@
24 - else 18 - else
25 %ul.well-list= render Commit.decorate(@commits), project: @project 19 %ul.well-list= render Commit.decorate(@commits), project: @project
26 20
27 - - unless @diffs.empty?  
28 - %h4 Diff 21 + %h4 Diff
  22 + - if @diffs.present?
29 = render "projects/commits/diffs", diffs: @diffs, project: @project 23 = render "projects/commits/diffs", diffs: @diffs, project: @project
  24 + - elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
  25 + .alert.alert-warning
  26 + %p
  27 + %strong Warning! This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
  28 + %p To preserve performance the line diff is not shown.
  29 +
30 - else 30 - else
31 .light-well 31 .light-well
32 %center 32 %center