summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-11-11 12:26:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-11-17 21:02:18 (GMT)
commit9b3f3de16c4a3b8414e5d49f79dda343a4ec1511 (patch)
tree3afb979318bfdfc6be75b98d457a607f51bd31cf /gitweb
parent60efa2451e46810bdf7da6a31758c779de8ff4f7 (diff)
downloadgit-9b3f3de16c4a3b8414e5d49f79dda343a4ec1511.zip
git-9b3f3de16c4a3b8414e5d49f79dda343a4ec1511.tar.gz
git-9b3f3de16c4a3b8414e5d49f79dda343a4ec1511.tar.bz2
gitweb: git_get_heads_list accepts an optional list of refs
git_get_heads_list(limit, class1, class2, ...) can now be used to retrieve refs/class1, refs/class2 etc. Defaults to ('heads', 'remotes') or ('heads') depending on whether the 'remote_heads' feature is enabled or not. 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>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl11
1 files changed, 7 insertions, 4 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e1787c2..951bb0d 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3169,15 +3169,18 @@ sub parse_from_to_diffinfo {
## parse to array of hashes functions
sub git_get_heads_list {
- my $limit = shift;
+ my ($limit, @classes) = @_;
+ unless (@classes) {
+ my $remote_heads = gitweb_check_feature('remote_heads');
+ @classes = ('heads', $remote_heads ? 'remotes' : ());
+ }
+ my @patterns = map { "refs/$_" } @classes;
my @headslist;
- my $remote_heads = gitweb_check_feature('remote_heads');
-
open my $fd, '-|', git_cmd(), 'for-each-ref',
($limit ? '--count='.($limit+1) : ()), '--sort=-committerdate',
'--format=%(objectname) %(refname) %(subject)%00%(committer)',
- 'refs/heads', ($remote_heads ? 'refs/remotes' : ())
+ @patterns
or return;
while (my $line = <$fd>) {
my %ref_item;