Subject: Re: Fwd: Gitweb error

From: Jakub Narebski <[email-masked]>
Date: Mon, 30 Jan 2012 20:08:48 +0100

On Mon, 30 Jan 2012, rajesh boyapati wrote:
> 2012/1/28 Jakub Narebski <[email-masked]>
>> On Fri, 27 Jan 2012, rajesh boyapati wrote:

>>>     my $alternate = 1;
>>>     for (my $i = $from; $i <= $to; $i++) {
>>>         my $entry = $headlist->[$i];
>>>         my %ref = %$entry;
>>>         my $curr = $ref{'id'} eq $head;
>>>         if ($alternate) {
>>>             print "<tr class=\"dark\">\n";
>>>         } else {
>>>             print "<tr class=\"light\">\n";
>>>         }
>>>         $alternate ^= 1;
>>
>> Hmmmm... I see that we do not check if $head is defined here before using
>> it.  This can happen legitimately if we are on yet to be born orphan branch
>> (so $head, which should be named $head_at, is undefined) but there exist
>> other branches (so $headlist is not empty).
>>
>> But I don't think it is what happened in your case, is it?

tldr; It did happen.
 
> For my git projects on gerrit, our main branch name is "base".
> We don't have any code on "master" branch.
> May be the $HEAD is looking for master branch(or checked out branch in git
> project).--> In our case, "master" is an empty branch.
> Also, In the git projects, the HEAD file is pointing to "ref:
> refs/heads/master".
> So, I think that's the reason for errors.
> 
> How can I make $HEAD to point to a branch other than "master"?.
>   a) I can do this by pointing HEAD file in git projects to other branch
[...]
>   b) Is there any way, other than doing above step (a) ?.
>      I mean I don't want to have a code on "master" branch and also I
>      don't want to point HEAD file in git projects to some other branch.
>      Do I need to make any modifications to "gitweb.cgi" for this?

Now that I know the source of this error, I can write test case
for it, and fix it.  I'll try to do it soon.

So finally what you would need for (b) is just upgrade gitweb.
-- 
Jakub Narebski
Poland