Re: [PATCH 3/7] gitweb: separate heads and remotes lists
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Sep 16, 2010, 22:54 UTC
- Message-ID
- <AANLkTimO7b8dxPKdOsEnoEpY6mAB86pKM3Cbc8GA4_CG@mail.gmail.com>
- In-Reply-To
- <201009170030.05999.jnareb@gmail.com>
On Thu, Sep 16, 2010 at 22:30, Jakub Narebski <jnareb@gmail.com> wrote:
Show 17 quoted lines
> On Thu, 16 Sep 2010, Ævar Arnfjörð Bjarmason wrote:
>> On Thu, Sep 16, 2010 at 09:31, Giuseppe Bilotta
>> <giuseppe.bilotta@gmail.com> wrote:
>>
>> > + if (@remotelist) {
>> > + git_print_header_div('remotes');
>> > + git_heads_body(\@remotelist, $head, 0, 15,
>> > + $#remotelist <= 15 ? undef :
>> > + $cgi->a({-href => href(action=>"remotes")}, "..."));
>> > + }
>>
>> Nit: The $# syntax is pseudo-deprecated, and since you use 16 as a
>> constant above this would be clearer anyway:
>>
>> @remotelist <= 16 ? undef : ...
>
> Actually gitweb uses *15* as a constant above...I mean above that snippet, i.e. this:
+ my @remotelist = $remote_heads ? git_get_heads_list(16, 'remotes') : ()
I think that's a bit clearer, you're not left wondering why it's 16 there and 15 here, and don't have to recall that `$#remotelist <= 15` equals `@remotelist <= 16` (unless $[ != 0). But like I said, it's a nit.