Thread (1 message) 1 message, 1 author, 2016-06-15
DORMANTno replies

[PATCH] gitweb: show rev only on the first line of each group in blame

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:38
Subsystem: the rest · Maintainer: Linus Torvalds

Thanks to the last round, this is now easy to do.

Signed-off-by: Junio C Hamano <redacted>
---
 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 "<tr><td>(malformed blame output)</td></tr>";
 			next;
@@ -2183,11 +2186,19 @@ sub flush_blame_lines {
 		my $lineno = $1;
 		my $data = $2;
 		print "<tr class=\"$color\">\n";
-		print "<td class=\"sha1\">" .
-		$cgi->a({-href => href(action=>"commit",
-				       hash=>$full_rev,
-				       file_name=>$file_name)},
-			esc_html($rev)) . "</td>\n";
+
+		if ($this == 1) {
+			if (1 < $cnt) {
+				print "<td class=\"sha1\" rowspan=\"$cnt\">";
+			}
+			else {
+				print "<td class=\"sha1\">";
+			}
+			print $cgi->a({-href => href(action=>"commit",
+						     hash=>$full_rev,
+						     file_name=>$file_name)},
+				      esc_html($rev)) . "</td>\n";
+		}
 		print +("<td class=\"linenr\">".
 			"<a id=\"l$lineno\" href=\"#l$lineno\" ".
 			"class=\"linenr\">" .
-- 
1.4.2.g39ee
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help