[PATCHv5 07/12] gitweb: remotes view for a single remote

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If the hash parameter is passed to gitweb, remotes will interpret it as
the name of a remote and limit the view the the heads of that remote.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx>
---
 gitweb/gitweb.perl |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 76cf806..7c62701 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5547,13 +5547,28 @@ sub git_remotes {
 		or die_error(403, "Remote heads view is disabled");
 
 	my $head = git_get_head_hash($project);
-	git_header_html();
-	git_print_page_nav('','', $head,undef,$head,format_ref_views('remotes'));
+	my $remote = $input_params{'hash'};
+
+	git_header_html(undef, undef, 'header_extra' => $remote);
+	git_print_page_nav('', '',  $head, undef, $head,
+		format_ref_views($remote ? '' : 'remotes'));
 	git_print_header_div('summary', $project);
 
-	my @remotelist = git_get_heads_list(undef, 'remotes');
-	if (@remotelist) {
-		git_heads_body(\@remotelist, $head);
+	if (defined $remote) {
+		# only display the heads in a given remote
+		my @headslist = map {
+			my $ref = $_ ;
+			$ref->{'name'} =~ s!^$remote/!!;
+			$ref
+		} git_get_heads_list(undef, "remotes/$remote");
+		if (@headslist) {
+			git_heads_body(\@headslist, $head);
+		}
+	} else {
+		my @remotelist = git_get_heads_list(undef, 'remotes');
+		if (@remotelist) {
+			git_heads_body(\@remotelist, $head);
+		}
 	}
 	git_footer_html();
 }
-- 
1.7.3.68.g6ec8

--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]