27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/controllers/concerns/rapid_diffs/resource.rb', line 27
def diff_file
return render_404 unless diffs_resource.present?
old_path = diff_file_params[:old_path]
new_path = diff_file_params[:new_path]
ignore_whitespace_changes = Gitlab::Utils.to_boolean(diff_file_params[:ignore_whitespace_changes])
full = Gitlab::Utils.to_boolean(diff_file_params[:full])
options = {
expanded: true,
ignore_whitespace_change: ignore_whitespace_changes,
use_extra_viewer_as_main: false
}
diff_file = find_diff_file(options, old_path, new_path)
return render_404 unless diff_file
if diff_file.whitespace_only? && ignore_whitespace_changes
options[:ignore_whitespace_change] = false
diff_file = find_diff_file(options, old_path, new_path)
end
if full
return head :payload_too_large if blob_too_large?(diff_file.blob)
diff_file.expand_to_full!
end
render diff_file_component(
diff_file: diff_file,
parallel_view: diff_view == :parallel,
plain_view: (Gitlab::Utils.to_boolean(diff_file_params[:plain_view]) if diff_file_params[:plain_view].present?)
), layout: false
end
|