Commit 423a1fbb authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'handle-too-large-file-diffs-push-email' into 'master'

In emails-on-push message, indicate message that individual file diff is too large

If a single file exceeded a diff limit, the previous implementation would just include the file as changed but the diff itself was not shown, leading to confusion:

![image](/uploads/18cd8e6b5c571305927097e1baf6097d/image.png)

Notice how the `nodes.pp` line shows no changes.

Diff overflow limits apply to different cases:

1. The entire diff exceeds 100 files OR 5000 lines
2. One single file exceeds 100 KB

Example case 2: Let's say we have a diff of 50 files, most of them under 100
KB, but one of them over that limit. In this case, the idea of
gitlab-org/gitlab-ce!2705 is that GitLab should show the diff of the 49 files
but omit the last one.

New screenshot:

![image](/uploads/9a0ac68e3deb08c28cab032fbbb80c9f/image.png)


See merge request !340
parents 2981044f 78c4474b
......@@ -54,28 +54,31 @@
%h4 Changes:
- diff_files.each_with_index do |diff_file, i|
%li{id: "diff-#{i}"}
%a{href: @message.target_url + "#diff-#{i}"}
%a{href: @message.target_url + "#diff-#{i}"}<
- if diff_file.deleted_file
%strong
%strong<
= diff_file.old_path
deleted
- elsif diff_file.renamed_file
%strong
%strong<
= diff_file.old_path
&rarr;
%strong
%strong<
= diff_file.new_path
- else
%strong
%strong<
= diff_file.new_path
%hr
- diff_commit = diff_file.deleted_file ? @message.diff_refs.first : @message.diff_refs.last
- blob = @message.project.repository.blob_for_diff(diff_commit, diff_file)
- if blob && blob.respond_to?(:text?) && blob_text_viewable?(blob)
%table.code.white
- diff_file.highlighted_diff_lines.each do |line|
= render "projects/diffs/line", {line: line, diff_file: diff_file, line_code: nil, plain: true}
- if diff_file.too_large?
The diff for this file was not included because it is too large.
- else
No preview for this file type
%hr
- diff_commit = diff_file.deleted_file ? @message.diff_refs.first : @message.diff_refs.last
- blob = @message.project.repository.blob_for_diff(diff_commit, diff_file)
- if blob && blob.respond_to?(:text?) && blob_text_viewable?(blob)
%table.code.white
- diff_file.highlighted_diff_lines.each do |line|
= render "projects/diffs/line", {line: line, diff_file: diff_file, line_code: nil, plain: true}
- else
No preview for this file type
%br
......@@ -43,7 +43,10 @@
- else
= diff_file.new_path
\=====================================
!= diff_file.diff.diff
- if diff_file.too_large?
The diff for this file was not included because it is too large.
- else
!= diff_file.diff.diff
- if @message.target_url
\
......
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