summaryrefslogtreecommitdiff
path: root/app/views/projects/diffs/_content.html.haml
blob: 5c38b5ad9c0444ebb3338537e03241491120e46b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
.diff-content.diff-wrap-lines
  -# Skip all non non-supported blobs
  - return unless blob.respond_to?(:text?)
  - if diff_file.too_large?
    .nothing-here-block This diff could not be displayed because it is too large.
  - elsif blob.only_display_raw?
    .nothing-here-block This file is too large to display.
  - elsif blob_text_viewable?(blob)
    - if !project.repository.diffable?(blob)
      .nothing-here-block This diff was suppressed by a .gitattributes entry.
    - elsif diff_file.collapsed?
      - url = url_for(params.merge(action: :diff_for_path, old_path: diff_file.old_path, new_path: diff_file.new_path, file_identifier: diff_file.file_identifier))
      .nothing-here-block.diff-collapsed{ data: { diff_for_path: url } }
        This diff is collapsed.
        %a.click-to-expand
          Click to expand it.
    - elsif diff_file.diff_lines.length > 0
      - total_lines = 0
      - if blob.lines.any?
        - total_lines = blob.lines.last.chomp == '' ? blob.lines.size - 1 : blob.lines.size
      - if diff_view == :parallel
        = render "projects/diffs/parallel_view", diff_file: diff_file, total_lines: total_lines
      - else
        = render "projects/diffs/text_file", diff_file: diff_file, total_lines: total_lines
    - else
      - if diff_file.mode_changed?
        .nothing-here-block File mode changed
      - elsif diff_file.renamed_file
        .nothing-here-block File moved
  - elsif blob.image?
    - old_blob = diff_file.old_blob(diff_file.old_content_commit || @base_commit)
    = render "projects/diffs/image", diff_file: diff_file, old_file: old_blob, file: blob
  - else
    .nothing-here-block No preview for this file type