Re: [PATCH] Gitweb: Avoid warnings when a repo does not have a valid HEAD
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:39
Junio C Hamano [off-list ref] writes:
Joe Ratterman [off-list ref] writes:quoted
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...., but in that case a repository with a HEAD that points at an unborn branch _and_ have other refs that do point at existing commit is already screwed-up, so if we want to be extremely pedantic then perhaps ... my $curr = ((defined $head && exists $ref{"id"} && defined $ref{"id"}) ? ($ref{"id"} eq $head) : 0);
Just in case, I was not suggesting to update the patch to look like the above by "if we want to be extremely pedantic". After all, that error message in the log may be a good thing that notifies the site administrators about a suspicious repository so that it can be fixed (even though it was not a designed "feature" but something that happens to work).