@matheusbsbs / matheus-bagliano / commits / 3665e7e7f2
Fork 0

gitweb: Mark commits with no "previous" in 'blame' view

Use "no-previous" class to mark blamed commits which do not have "previous" header. Those are commits in which blamed file was created (added); this includes boundary commits. This means that 'linenr' link leads to blamed commit, not (one of) parent of blamed commit. Therefore currently line number for such commit uses bold weight font to denote this situation; the effect is subtle. Use "multiple-previous" class in the opposite situation, where blamed commit has multiple "previous" headers (is an evil merge). Currently this class is not used for styling. In this situation 'linenr' link leads to first of "previous" commits (first parent). Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jakub Narebski committed Jul 25, 2009 at 00:44 UTC 3665e7e7f2b210f6896815d563255c364a861a6e
2 files changed +8 -2
gitweb/gitweb.css
+2 -1
@@ -242,7 +242,8 @@ tr.dark:hover {
242 background-color: #edece6;
243 }
244
245 -tr.boundary td.sha1 {
245 +tr.boundary td.sha1,
246 +tr.no-previous td.linenr {
247 font-weight: bold;
248 }
249
gitweb/gitweb.perl
+6 -1
@@ -4819,7 +4819,7 @@ HTML
4819 my ($full_rev, $orig_lineno, $lineno, $group_size) =
4820 ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/);
4821 if (!exists $metainfo{$full_rev}) {
4822 - $metainfo{$full_rev} = {};
4822 + $metainfo{$full_rev} = { 'nprevious' => 0 };
4823 }
4824 my $meta = $metainfo{$full_rev};
4825 my $data;
@@ -4829,6 +4829,9 @@ HTML
4829 if ($data =~ /^(\S+)(?: (.*))?$/) {
4830 $meta->{$1} = $2 unless exists $meta->{$1};
4831 }
4832 + if ($data =~ /^previous /) {
4833 + $meta->{'nprevious'}++;
4834 + }
4835 }
4836 my $short_rev = substr($full_rev, 0, 8);
4837 my $author = $meta->{'author'};
@@ -4840,6 +4843,8 @@ HTML
4843 }
4844 my $tr_class = $rev_color[$current_color];
4845 $tr_class .= ' boundary' if (exists $meta->{'boundary'});
4846 + $tr_class .= ' no-previous' if ($meta->{'nprevious'} == 0);
4847 + $tr_class .= ' multiple-previous' if ($meta->{'nprevious'} > 1);
4848 print "<tr id=\"l$lineno\" class=\"$tr_class\">\n";
4849 if ($group_size) {
4850 print "<td class=\"sha1\"";