Prevent 500 error on Compare page if diff read timout happens
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
8f88cbf06b
commit
a1a01254b9
|
@ -16,6 +16,11 @@ class Projects::CompareController < Projects::ApplicationController
|
|||
@refs_are_same = compare.same
|
||||
@line_notes = []
|
||||
|
||||
if @diffs == [Gitlab::Git::Diff::BROKEN_DIFF]
|
||||
@diffs = []
|
||||
@timeout = true
|
||||
end
|
||||
|
||||
diff_line_count = Commit::diff_line_count(@diffs)
|
||||
@suppress_diff = Commit::diff_suppress?(@diffs, diff_line_count) && !params[:force_show_diff]
|
||||
@force_suppress_diff = Commit::diff_force_suppress?(@diffs, diff_line_count)
|
||||
|
|
|
@ -22,10 +22,14 @@
|
|||
- if @diffs.present?
|
||||
= render "projects/commits/diffs", diffs: @diffs, project: @project
|
||||
- elsif @commits.size > MergeRequestDiff::COMMITS_SAFE_SIZE
|
||||
.alert.alert-warning
|
||||
%p
|
||||
%strong Warning! This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
|
||||
.bs-callout.bs-callout-danger
|
||||
%h4 This comparison includes more than #{MergeRequestDiff::COMMITS_SAFE_SIZE} commits.
|
||||
%p To preserve performance the line diff is not shown.
|
||||
- elsif @timeout
|
||||
.bs-callout.bs-callout-danger
|
||||
%h4 Diff for this comparison is extremely large.
|
||||
%p Use command line to browse diff for this comparison.
|
||||
|
||||
|
||||
- else
|
||||
.light-well
|
||||
|
|
Loading…
Reference in New Issue