@matheusbsbs / matheus-bagliano / commits / bb60776063
Fork 0

gitweb: remotes view for a single remote

When 'remotes' view is passed the 'hash' parameter, interpret it as the name of a remote and limit the view the the heads of that remote. In single-remote view we let the user switch easily to the default remotes view by specifying an -action_extra for the page header and by enabling the 'remotes' link in the reference navigation submenu. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Giuseppe Bilotta committed Nov 11, 2010 at 13:26 UTC bb60776063f0575c1a880cd606b7470e36a7cd86
1 file changed +26 -4
gitweb/gitweb.perl
+26 -4
@@ -5558,14 +5558,36 @@ sub git_remotes {
5558 or die_error(403, "Remote heads view is disabled");
5559
5560 my $head = git_get_head_hash($project);
5561 - git_header_html();
5562 - git_print_page_nav('','', $head,undef,$head,format_ref_views('remotes'));
5563 - git_print_header_div('summary', $project);
5561 + my $remote = $input_params{'hash'};
5562 +
5563 + my @remotelist;
5564 +
5565 + if (defined $remote) {
5566 + # only display the heads in a given remote, stripping the
5567 + # remote name which is already visible elsewhere
5568 + @remotelist = map {
5569 + my $ref = $_ ;
5570 + $ref->{'name'} =~ s!^$remote/!!;
5571 + $ref
5572 + } git_get_heads_list(undef, "remotes/$remote");
5573 + } else {
5574 + @remotelist = git_get_heads_list(undef, 'remotes');
5575 + }
5576 +
5577 + git_header_html(undef, undef, -action_extra => $remote);
5578 + git_print_page_nav('', '', $head, undef, $head,
5579 + format_ref_views($remote ? '' : 'remotes'));
5580 +
5581 + if (defined $remote) {
5582 + git_print_header_div('remotes', "$remote remote for $project");
5583 + } else {
5584 + git_print_header_div('summary', "$project remotes");
5585 + }
5586
5565 - my @remotelist = git_get_heads_list(undef, 'remotes');
5587 if (@remotelist) {
5588 git_heads_body(\@remotelist, $head);
5589 }
5590 +
5591 git_footer_html();
5592 }
5593