_diffs.html.haml 2.39 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
Izaak Alpert's avatar
Izaak Alpert committed
8
      = link_to "click this link", project_commit_path(project, @commit, force_show_diff: true), class: "underlined_link"
9

10 11 12 13 14 15 16 17 18
%p.commit-stat-summary
  Showing
  %strong.cdark #{pluralize(diffs.count, "changed file")}
  - if current_controller?(:commit)
    - unless @commit.has_zero_stats?
      with
      %strong.cgreen #{@commit.stats.additions} additions
      and
      %strong.cred #{@commit.stats.deletions} deletions
19
.file-stats
20
  = render "projects/commits/diff_head", diffs: diffs
21

22 23 24 25
.files
  - unless @suppress_diff
    - diffs.each_with_index do |diff, i|
      - next if diff.diff.empty?
Izaak Alpert's avatar
Izaak Alpert committed
26 27
      - file = Gitlab::Git::Blob.new(project.repository, @commit.id, @ref, diff.new_path)
      - file = Gitlab::Git::Blob.new(project.repository, @commit.parent_id, @ref, diff.old_path) unless file.exists?
28
      - next unless file.exists?
29 30 31 32
      .file{id: "diff-#{i}"}
        .header
          - if diff.deleted_file
            %span= diff.old_path
33

34
            - if @commit.parent_ids.present?
Izaak Alpert's avatar
Izaak Alpert committed
35
              = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
36 37 38 39 40 41 42
                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}"

Izaak Alpert's avatar
Izaak Alpert committed
43
            = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
44 45
              View file @
              %span.commit-short-id= @commit.short_id(6)
46

47 48 49 50
        .content
          -# Skipp all non non-supported blobs
          - next unless file.respond_to?('text?')
          - if file.text?
51
            = render "projects/commits/text_file", diff: diff, index: i
52
          - elsif file.image?
Izaak Alpert's avatar
Izaak Alpert committed
53
            - old_file = Gitlab::Git::Blob.new(project.repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id
54
            = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
55
          - else
56
            %p.nothing_here_message No preview for this file type