BigW Consortium Gitlab

_diffs.html.haml 2.14 KB
Newer Older
1
- if @suppress_diff
2
  .alert.alert-block
3
    %p
4
      %strong Warning! Large commit with more than #{Commit::DIFF_SAFE_SIZE} files changed.
5
    %p To prevent performance issue we rejected diff information.
6 7
    %p
      But if you still want to see diff
8
      = link_to "click this link", project_commit_path(@project, @commit, force_show_diff: true), class: "underlined_link"
9 10 11

%p.cgray
  Showing #{pluralize(diffs.count, "changed file")}
12
.file-stats
13
  = render "projects/commits/diff_head", diffs: diffs
14

15 16 17 18
.files
  - unless @suppress_diff
    - diffs.each_with_index do |diff, i|
      - next if diff.diff.empty?
19 20
      - file = Gitlab::Git::Blob.new(@repository, @commit.id, @ref, diff.new_path)
      - file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) unless file.exists?
21
      - next unless file.exists?
22 23 24 25
      .file{id: "diff-#{i}"}
        .header
          - if diff.deleted_file
            %span= diff.old_path
26

27
            - if @commit.parent_ids.present?
28
              = link_to project_blob_path(@project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
29 30 31 32 33 34 35
                View file @
                %span.commit-short-id= @commit.short_id(6)
          - else
            %span= diff.new_path
            - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
              %span.file-mode= "#{diff.a_mode}#{diff.b_mode}"

36
            = link_to project_blob_path(@project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
37 38
              View file @
              %span.commit-short-id= @commit.short_id(6)
39

40 41 42 43
        .content
          -# Skipp all non non-supported blobs
          - next unless file.respond_to?('text?')
          - if file.text?
44
            = render "projects/commits/text_file", diff: diff, index: i
45
          - elsif file.image?
46
            - old_file = Gitlab::Git::Blob.new(@repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id
47
            = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
48
          - else
49
            %p.nothing_here_message No preview for this file type