Commit 8f88cbf06bce7e88b9a4470645665b65ca543946
1 parent
68249f23
Exists in
spb-stable
and in
3 other branches
Use MergeRequestDiff::COMMITS_SAFE_SIZE for Compare diff limit.
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
10 additions
and
10 deletions
Show diff stats
app/controllers/projects/compare_controller.rb
... | ... | @@ -8,7 +8,7 @@ class Projects::CompareController < Projects::ApplicationController |
8 | 8 | end |
9 | 9 | |
10 | 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 | 13 | @commits = compare.commits |
14 | 14 | @commit = compare.commit | ... | ... |
app/views/projects/compare/_form.html.haml
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | |
15 | 15 | = submit_tag "Compare", class: "btn btn-create commits-compare-btn" |
16 | 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 | 18 | %strong Make a merge request |
19 | 19 | |
20 | 20 | ... | ... |
app/views/projects/compare/show.html.haml
... | ... | @@ -5,12 +5,6 @@ |
5 | 5 | |
6 | 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 | 8 | - if @commits.present? |
15 | 9 | %div.ui-box |
16 | 10 | .title |
... | ... | @@ -24,9 +18,15 @@ |
24 | 18 | - else |
25 | 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 | 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 | 30 | - else |
31 | 31 | .light-well |
32 | 32 | %center | ... | ... |