threads / patch / 13774

patchMake cell alignment more robust in gitweb blame

Subject: [PATCH] Make cell alignment more robust in gitweb blame

## tl;dr

3 messages between Jun 3, 2008 and Jun 3, 2008. Diffs are folded; open one to read it.

replies: 2people: 1as markdown or json

Rafael Garcia-Suarez· Jun 3, 2008, 10:14 UTC · lore

[PATCH] Avoid git-rev-parse warnings in gitweb blame

Adding a '--' to the command-line avoids git-rev-parse emitting an error message "ambiguous argument... Use '--' to separate paths from revisions".

Signed-off-by: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to gitweb/gitweb.perl +1 −1
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 55fb100..472326f 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4226,7 +4226,7 @@ HTML
 			              esc_html($rev));
 			print "</td>\n";
 		}
-		open (my $dd, "-|", git_cmd(), "rev-parse", "$full_rev^")
+		open (my $dd, "-|", git_cmd(), "rev-parse", '--', "$full_rev^")
 			or die_error(undef, "Open git-rev-parse failed");
 		my $parent_commit = <$dd>;
 		close $dd;
-- 
1.5.6.rc1
Rafael Garcia-Suarez· Jun 3, 2008, 10:14 UTC · re: Rafael Garcia-Suarez · lore

It appears that git-blame's returned group size can be wrong, inducing the table display to be completely broken.

For gitweb to cope with that in a more robust manner, we can drop the "rowspan" argument to the first <td> containing the blame commit id, and just put empty cells instead, whenever we have nothing to print in that column.

Signed-off-by: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
---
 gitweb/gitweb.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Show changes to gitweb/gitweb.perl +3 −1
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 472326f..c760884 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4218,7 +4218,6 @@ HTML
 		if ($group_size) {
 			print "<td class=\"sha1\"";
 			print " title=\"". esc_html($author) . ", $date\"";
-			print " rowspan=\"$group_size\"" if ($group_size > 1);
 			print ">";
 			print $cgi->a({-href => href(action=>"commit",
 			                             hash=>$full_rev,
@@ -4226,6 +4225,9 @@ HTML
 			              esc_html($rev));
 			print "</td>\n";
 		}
+		else {
+			print "<td class=\"sha1\">&nbsp;</td>";
+		}
 		open (my $dd, "-|", git_cmd(), "rev-parse", '--', "$full_rev^")
 			or die_error(undef, "Open git-rev-parse failed");
 		my $parent_commit = <$dd>;
-- 
1.5.6.rc1
Rafael Garcia-Suarez· Jun 3, 2008, 10:26 UTC · re: Rafael Garcia-Suarez · lore

Re: [PATCH] Avoid git-rev-parse warnings in gitweb blame

2008/6/3 Rafael Garcia-Suarez <rgarciasuarez@gmail.com>:
> Adding a '--' to the command-line avoids git-rev-parse emitting an error
> message "ambiguous argument... Use '--' to separate paths from revisions".

Oh, well, scratch that. I'm (now obviously to me) trying to hide a bug under the carpet here. Sorry for the noise.

← back to recent threads