Showing 4 changed files with 16 additions and 39 deletions
+10 -3
templates/include/blob_diff_body.html.ep
... ...
@@ -3,12 +3,14 @@
3 3
   my $from_rev = stash('from_rev');
4 4
   my $diff_tree = stash('diff_tree');
5 5
   my $blob_diff = stash('blob_diff');
6
+  my $from_mode_str = $diff_tree->{from_mode_str};
7
+  my $to_mode_str = $diff_tree->{to_mode_str};
6 8
   my $lines = $blob_diff->{lines} || [];
7 9
   my $file = $blob_diff->{file};
8 10
   $file = '' unless defined $file;
9 11
   my $from_file = $blob_diff->{from_file};
10 12
   $from_file = $file unless defined $from_file;
11
-  my $status = $blob_diff->{status} || '';
13
+  my $status = $diff_tree->{status} || '';
12 14
 %>
13 15
 
14 16
   <div style="margin-bottom:20px;">
... ...
@@ -19,6 +21,9 @@
19 21
             %= include '/include/diff_status_bar', diff_tree => $diff_tree;
20 22
           </div>
21 23
           <%= $file %>
24
+          % if ($status ne 'A' && $status ne 'D' && $from_mode_str ne $to_mode_str) {
25
+            <%= "100$from_mode_str → 100$to_mode_str" %>
26
+          % }
22 27
         </div>
23 28
         <div class="text-right">
24 29
           % if ($status eq 'D') {
... ...
@@ -90,8 +95,10 @@
90 95
         <div class="border-gray" style="padding:10px;margin-bottom:30px;border-top:none">
91 96
           % if ($status eq 'R') {
92 97
             File renamed without changes.
93
-          % } else {
94
-            No changes.
98
+          % } elsif ($status eq 'A' || $status eq 'D') {
99
+             No changes.
100
+          % } elsif ($from_mode_str ne $to_mode_str) {
101
+            File mode changed.
95 102
           % }
96 103
         </div>
97 104
       % }
+3 -10
templates/include/diff_status_bar.html.ep
... ...
@@ -6,16 +6,9 @@
6 6
   my $diff_line_count = $add_line_count + $delete_line_count;
7 7
   my $diff_count_text;
8 8
   my $status = $diff_tree->{status};
9
-  if ($status eq 'A' && $add_line_count == 0) {
10
-    $diff_count_text = 'Empty file added';
11
-  }
12
-  elsif ($diff_tree->{status} eq 'R' && $add_line_count == 0 && $delete_line_count == 0) {
13
-    $diff_count_text = 'Empty file renamed';
14
-  }
15
-  else {
16
-    $diff_count_text = "$add_line_count additions";
17
-    $diff_count_text .= " & $delete_line_count deletions" if $delete_line_count > 0;
18
-  }
9
+
10
+  $diff_count_text = "$add_line_count additions";
11
+  $diff_count_text .= " & $delete_line_count deletions" if $delete_line_count > 0;
19 12
   my $tag = $fragment ? 'a' : 'span';
20 13
   my $add_block_count = $diff_tree->{add_block_count} || 0;
21 14
   my $delete_block_count = $diff_tree->{delete_block_count} || 0;
+3 -25
templates/include/diff_tree.html.ep
... ...
@@ -148,10 +148,7 @@
148 148
         % my $mode_str = $diff_tree->{to_mode_str};
149 149
         % my $mode_oct = $diff_tree->{to_mode_oct};
150 150
         % my $from_file = $diff_tree->{from_file};
151
-        % my $from_file_type = $diff_tree->{from_file_type};
152
-        % my $from_mode = $diff_tree->{from_mode};
153 151
         % my $from_mode_str = $diff_tree->{from_mode_str};
154
-        % my $from_mode_oct = $diff_tree->{from_mode_oct};
155 152
         <td style="padding:7px 5px 7px 0; width:12px">
156 153
           % if ($status eq 'A') {
157 154
             <div class="file-add" title="added">+</div>
... ...
@@ -159,23 +156,6 @@
159 156
             <div class="file-del" title="deleted">-</div>
160 157
           % } elsif ($status eq 'M' || $status eq 'T') {
161 158
             <div class="file-modified" title="modified">●</div>
162
-            % if ($from_mode != $mode) {
163
-              <span>
164
-                [
165
-                  changed
166
-                  % if ($from_file_type ne $file_type) {
167
-                    from <%= $from_file_type %> to <%= $file_type %>
168
-                  % }
169
-                  % if (($from_mode_oct & 0777) != ($mode_oct & 0777)) {
170
-                    % if ($from_mode_str && $mode_str) {
171
-                      mode: <%= $from_mode_str %>-><%= $mode_str %>
172
-                    % } elsif ($mode_str) {
173
-                      mode: <%= $mode_str %>
174
-                    % }
175
-                  % }
176
-                ]
177
-              </span>
178
-            % }
179 159
           % } elsif ($status eq 'R') {
180 160
             <div class="file-renamed" title="renamed">▶</div>
181 161
           % } elsif ($status eq 'C') {
... ...
@@ -188,16 +168,14 @@
188 168
           % } elsif ($status eq 'T') {
189 169
             
190 170
           % } elsif ($status eq 'R' || $status eq 'C') {
191
-            % my $mode_change;
192
-            % if ($diff_tree->{'from_mode'} != $diff_tree->{'to_mode'}) {
193
-              % $mode_change = sprintf(", mode: %04o", oct $diff_tree->{to_mode} & 0777);
194
-            % }
195 171
             
196 172
             <a href="#<%= "diff-$num" %>"><%= $diff_tree->{from_file} %> → <%= $file %></a>
197 173
             % unless ($diff_tree->{similarity} == 100) {
198 174
               with <%= $diff_tree->{similarity} %>
199 175
             % }
200
-            <%= $mode_change || '' %>
176
+          % }
177
+          % if ($status ne 'A' && $status ne 'D' && $from_mode_str ne $mode_str) {
178
+            <%= "100$from_mode_str → 100$mode_str" %>
201 179
           % }
202 180
         </td>
203 181
         <td style="text-align:right">
-1
xt/basic.t
... ...
@@ -105,7 +105,6 @@ note 'Commit page';
105 105
     
106 106
     # Empty file is added
107 107
     $t->content_like(qr/No changes/);
108
-    $t->content_like(qr/Empty file added/);
109 108
     $t->content_like(qr/class="file-add"/);
110 109
   }
111 110