Commit d29bb23a6896c1c660fe27d1a9bd5dbfde94bf52

Authored by Dmitriy Zaporozhets
1 parent b48bb4a7

Update gitlab-grit to newer version with normal diff collection. Show if file mode was changed

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Gemfile.lock
... ... @@ -164,7 +164,7 @@ GEM
164 164 multi_json
165 165 gitlab-grack (2.0.0.pre)
166 166 rack (~> 1.5.1)
167   - gitlab-grit (2.6.8)
  167 + gitlab-grit (2.6.9)
168 168 charlock_holmes (~> 0.6)
169 169 diff-lcs (~> 1.1)
170 170 mime-types (~> 1.15)
... ...
app/assets/stylesheets/sections/diff.scss
... ... @@ -11,7 +11,6 @@
11 11  
12 12 > span {
13 13 font-family: $monospace_font;
14   - font-size: 14px;
15 14 line-height: 2;
16 15 }
17 16  
... ... @@ -19,9 +18,7 @@
19 18 float: right;
20 19  
21 20 .btn {
22   - background-color: #EEE;
23   - color: #666;
24   - font-weight: bolder;
  21 + background-color: #FFF;
25 22 }
26 23 }
27 24  
... ... @@ -32,6 +29,7 @@
32 29  
33 30 .file-mode {
34 31 font-family: $monospace_font;
  32 + margin-left: 10px;
35 33 }
36 34 }
37 35 .diff-content {
... ... @@ -51,6 +49,11 @@
51 49 }
52 50 }
53 51  
  52 + .file-mode-changed {
  53 + padding: 10px;
  54 + color: #777;
  55 + }
  56 +
54 57 table {
55 58 width: 100%;
56 59 font-family: $monospace_font;
... ...
app/helpers/commits_helper.rb
... ... @@ -216,4 +216,8 @@ module CommitsHelper
216 216 link_to(text.html_safe, user_path(user), options)
217 217 end
218 218 end
  219 +
  220 + def diff_file_mode_changed?(diff)
  221 + diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
  222 + end
219 223 end
... ...
app/views/projects/commits/_diffs.html.haml
... ... @@ -42,7 +42,6 @@
42 42 .files
43 43 - unless @suppress_diff
44 44 - diffs.each_with_index do |diff, i|
45   - - next if diff.diff.empty?
46 45 - file = project.repository.blob_at(@commit.id, diff.new_path)
47 46 - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file
48 47 - next unless file
... ... @@ -58,7 +57,7 @@
58 57 %span.commit-short-id= @commit.short_id(6)
59 58 - else
60 59 %span= diff.new_path
61   - - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
  60 + - if diff_file_mode_changed?(diff)
62 61 %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"
63 62  
64 63 .diff-btn-group
... ...
app/views/projects/commits/_text_file.html.haml
... ... @@ -22,3 +22,6 @@
22 22 - unless comments.empty?
23 23 = render "projects/notes/diff_notes_with_reply", notes: comments, line: line
24 24  
  25 +- if diff.diff.blank? && diff_file_mode_changed?(diff)
  26 + .file-mode-changed
  27 + File mode changed
... ...