]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Use light/dark for class names also in 'blame' view
[Gitweb] / gitweb.perl
index 13910bc9fa4668106f5e43882f0b1d9537f883f627edebbf6fee21fa974f571a..5b78db5709e4eda8d794ffcc937216a2745476167013545774c23a88ed785a31 100755 (executable)
@@ -4802,7 +4802,7 @@ sub git_blame {
        git_print_page_path($file_name, $ftype, $hash_base);
 
        # page body
-       my @rev_color = qw(light2 dark2);
+       my @rev_color = qw(light dark);
        my $num_colors = scalar(@rev_color);
        my $current_color = 0;
        my %metainfo = ();
@@ -4820,7 +4820,7 @@ HTML
                my ($full_rev, $orig_lineno, $lineno, $group_size) =
                   ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/);
                if (!exists $metainfo{$full_rev}) {
-                       $metainfo{$full_rev} = {};
+                       $metainfo{$full_rev} = { 'nprevious' => 0 };
                }
                my $meta = $metainfo{$full_rev};
                my $data;
@@ -4830,6 +4830,9 @@ HTML
                        if ($data =~ /^(\S+)(?: (.*))?$/) {
                                $meta->{$1} = $2 unless exists $meta->{$1};
                        }
+                       if ($data =~ /^previous /) {
+                               $meta->{'nprevious'}++;
+                       }
                }
                my $short_rev = substr($full_rev, 0, 8);
                my $author = $meta->{'author'};
@@ -4841,6 +4844,8 @@ HTML
                }
                my $tr_class = $rev_color[$current_color];
                $tr_class .= ' boundary' if (exists $meta->{'boundary'});
+               $tr_class .= ' no-previous' if ($meta->{'nprevious'} == 0);
+               $tr_class .= ' multiple-previous' if ($meta->{'nprevious'} > 1);
                print "<tr id=\"l$lineno\" class=\"$tr_class\">\n";
                if ($group_size) {
                        print "<td class=\"sha1\"";
@@ -4851,6 +4856,14 @@ HTML
                                                     hash=>$full_rev,
                                                     file_name=>$file_name)},
                                      esc_html($short_rev));
+                       if ($group_size >= 2) {
+                               my @author_initials = ($author =~ /\b([[:upper:]])\B/g);
+                               if (@author_initials) {
+                                       print "<br />" .
+                                             esc_html(join('', @author_initials));
+                                       #           or join('.', ...)
+                               }
+                       }
                        print "</td>\n";
                }
                # 'previous' <sha1 of parent commit> <filename at commit>
This page took 0.274308 seconds and 4 git commands to generate.