From: Junio C Hamano Date: Tue, 29 Aug 2006 09:06:37 GMT Subject: [PATCH] gitweb: show rev only on the first line of each group in blame Message-ID: <7vbqq3oqqq.fsf_-_@assigned-by-dhcp.cox.net> In-Reply-To: <7vveocpfa3.fsf@assigned-by-dhcp.cox.net> Thanks to the last round, this is now easy to do. Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 28e1cfd..5c82d3f 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2174,8 +2174,11 @@ sub flush_blame_lines { my ($color, $file_name, @line) = @_; my $full_rev = shift @line; my $rev = substr($full_rev, 0, 8); + my $cnt = scalar @line; + my $this = 0; for (@line) { + $this++; unless (/^[0-9a-fA-F]{40}.*?(\d+)\)\s(.*)/) { print "(malformed blame output)"; next; @@ -2183,11 +2186,19 @@ sub flush_blame_lines { my $lineno = $1; my $data = $2; print "\n"; - print "" . - $cgi->a({-href => href(action=>"commit", - hash=>$full_rev, - file_name=>$file_name)}, - esc_html($rev)) . "\n"; + + if ($this == 1) { + if (1 < $cnt) { + print ""; + } + else { + print ""; + } + print $cgi->a({-href => href(action=>"commit", + hash=>$full_rev, + file_name=>$file_name)}, + esc_html($rev)) . "\n"; + } print +("". "" . -- 1.4.2.g39ee