From: Joe Ratterman Date: Thu, 15 Dec 2011 20:58:57 GMT Subject: [PATCH] Gitweb: Avoid warnings when a repo does not have a valid HEAD Message-ID: <1323982737-19065-1-git-send-email-jratt0@gmail.com> It is possible that the HEAD reference does not point to an existing branch. When viewing such a repository in gitweb, a message like this one was sent to the error log: gitweb.cgi: Use of uninitialized value in string eq at /usr/src/git/gitweb/gitweb.cgi line 5115. Signed-off-by: Joe Ratterman --- gitweb/gitweb.perl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4f0c3bd..5af06d6 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -5440,7 +5440,7 @@ sub git_heads_body { for (my $i = $from; $i <= $to; $i++) { my $entry = $headlist->[$i]; my %ref = %$entry; - my $curr = $ref{'id'} eq $head; + my $curr = $head ? ($ref{'id'} eq $head) : 0; if ($alternate) { print "\n"; } else { -- 1.7.7.1