The purpose of this function is to split a headlist into groups determined by the leading part of the refname, and call git_heads_body() on each group. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx> --- gitweb/gitweb.perl | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index a736f2a..836b6ba 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -4271,6 +4271,37 @@ sub git_tags_body { print "</table>\n"; } +sub git_split_heads_body { + my ($headlist, $head, $from, $to, $extra) = @_; + my %headlists; + my $leader; my $list; my @list; + + # Split @$headlist into a hash of lists + map { + my %ref = %$_; + $ref{'hname'} = $ref{'name'}; + if ($ref{'name'} =~ /\//) { + $ref{'name'} =~ s!^([^/]+)/!!; + $leader = $1; + } else { + $leader = "\000"; + } + if (defined $headlists{$leader}) { + @list = @{$headlists{$leader}} + } else { + @list = () + } + push @list, \%ref; + $headlists{$leader} = [@list]; + } @$headlist; + + foreach $leader (sort(keys %headlists)) { + print "<b>$leader</b><br/>\n" unless $leader eq "\000"; + $list = $headlists{$leader}; + git_heads_body($list, $head, $from, $to, $extra); + } +} + sub git_heads_body { # uses global variable $project my ($headlist, $head, $from, $to, $extra) = @_; @@ -4541,7 +4572,7 @@ sub git_summary { if (@remotelist) { git_print_header_div('remotes'); - git_heads_body(\@remotelist, $head, 0, 15, + git_split_heads_body(\@remotelist, $head, 0, 15, $#remotelist <= 15 ? undef : $cgi->a({-href => href(action=>"heads")}, "...")); } -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html