Showing 3 changed files with 29 additions and 8 deletions
+22 -1
lib/Gitprep/Git.pm
... ...
@@ -831,7 +831,6 @@ sub parse_blobdiff_lines {
831 831
   # Parse
832 832
   my @lines;
833 833
   for my $line (@$lines_raw) {
834
-    $line = $self->dec($line);
835 834
     chomp $line;
836 835
     my $class;
837 836
     
... ...
@@ -848,6 +847,28 @@ sub parse_blobdiff_lines {
848 847
   return \@lines;
849 848
 }
850 849
 
850
+sub parse_blobdiff_lines {
851
+  my ($self, $lines_raw) = @_;
852
+  
853
+  # Parse
854
+  my @lines;
855
+  for my $line (@$lines_raw) {
856
+    chomp $line;
857
+    my $class;
858
+    
859
+    if ($line =~ /^diff \-\-git /) { $class = 'header' }
860
+    elsif ($line =~ /^index /) { $class = 'extended_header' }
861
+    elsif ($line =~ /^\+/) { $class = 'to_file' }
862
+    elsif ($line =~ /^\-/) { $class = 'from_file' }
863
+    elsif ($line =~ /^\@\@/) { $class = 'chunk_header' }
864
+    elsif ($line =~ /^Binary files/) { $class = 'binary_file' }
865
+    else { $class = 'diff' }
866
+    push @lines, {value => $line, class => $class};
867
+  }
868
+  
869
+  return \@lines;
870
+}
871
+
851 872
 sub parse_commit {
852 873
   my ($self, $user, $project, $id) = @_;
853 874
   
+6 -6
templates/include/blobdiff_body.html.ep
... ...
@@ -1,10 +1,10 @@
1
-<div>
1
+<div class="border-gray" style="margin-bottom:20px;">
2 2
   % my $start;
3 3
   % for my $line (@$lines) {
4 4
     % my $class = $line->{class};
5 5
     % my $value = $line->{value};
6 6
     % unless ($start) {
7
-      % if ($class eq 'diff header') {
7
+      % if ($class eq 'header') {
8 8
         % $start = 1;
9 9
       % }
10 10
       % else { next }
... ...
@@ -13,8 +13,8 @@
13 13
     % next if $value =~ /^--- /;
14 14
     % next if $value =~ /^\+\+\+ /;
15 15
     % my $status = stash('status') || '';
16
-    % if ($class eq 'diff header') {
17
-      <div class="border-gray padding5 bk-gray-light" style="margin-top:20px;">
16
+    % if ($class eq 'header') {
17
+      <div class="border-bottom-gray padding5 bk-gray-light">
18 18
         <div class="row">
19 19
           <div class="span8" style="padding-top:6px">
20 20
             <%= $file %>
... ...
@@ -26,7 +26,7 @@
26 26
           </div>
27 27
         </div>
28 28
       </div>
29
-    % } elsif ($class eq 'diff binary_file') {
29
+    % } elsif ($class eq 'binary_file') {
30 30
       Binary files
31 31
       <a href="<%= url_for("/$user/$project/blob/$from_id/$file") %>">a/<%= $file %></a>
32 32
       and
... ...
@@ -43,7 +43,7 @@
43 43
       % } else {
44 44
         % $bk_color = '';
45 45
       % }
46
-      <div style="padding-left:5px;background-color:<%= $bk_color %>;border-left:1px solid #ccc;border-right:1px #ccc solid">
46
+      <div style="padding-left:5px;background-color:<%= $bk_color %>;">
47 47
         <%= $value %>
48 48
       </div>
49 49
     % }
+1 -1
templates/include/difftree.html.ep
... ...
@@ -12,7 +12,7 @@
12 12
           % my $parent = $parents->[$i];
13 13
           % my $from_id = $parent;
14 14
           <th>
15
-            <a href="<%= url_for('commitdiff', project => $project_ns, diff => "$from_id..$id") %>"
15
+            <a href="<%= url_for("/$user/$project/commit/$from_id..$id") %>"
16 16
                 title="commitdiff to parent number <%= $i + 1 %> <%= substr($from_id, 0, 7) %>">
17 17
               <%= $i + 1 %>
18 18
             </a>