git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: Fix "Use of uninitialized value" warning in git_tags_body

From
Jakub Narebski <jnareb@gmail.com>
Date
Jan 3, 2007, 21:54 UTC
Message-ID
<11678612691404-git-send-email-jnareb@gmail.com>

Fix "Use of uninitialized value" warning in git_tags_body generated for lightweight tags of tree and blob object; those don't have age ($tag{'age'}) defined.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 2179054..fd671f3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2813,8 +2813,12 @@ sub git_tags_body {
 			print "<tr class=\"light\">\n";
 		}
 		$alternate ^= 1;
-		print "<td><i>$tag{'age'}</i></td>\n" .
-		      "<td>" .
+		if (defined $tag{'age'}) {
+			print "<td><i>$tag{'age'}</i></td>\n";
+		} else {
+			print "<td></td>\n";
+		}
+		print "<td>" .
 		      $cgi->a({-href => href(action=>$tag{'reftype'}, hash=>$tag{'refid'}),
 		               -class => "list name"}, esc_html($tag{'name'})) .
 		      "</td>\n" .
-- 
1.4.4.3
Next: Jakub Narebski
Message 1 of 4 in “gitweb: Fix "Use of uninitialized value" warning in git_tags_body”
  1. gitweb: Fix "Use of uninitialized value" warning in git_tags_bodyJakub Narebski, Jan 3, 2007
  2. Jakub NarebskiJan 3, 2007
  3. Junio C HamanoJan 4, 2007
  4. Jakub NarebskiJan 7, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.