summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 60efa24)
raw | patch | inline | side by side (parent: 60efa24)
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | |
Thu, 11 Nov 2010 12:26:10 +0000 (13:26 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 17 Nov 2010 21:02:18 +0000 (13:02 -0800) |
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>
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>
gitweb/gitweb.perl | patch | blob | history |
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e1787c2e0e45ae8ef0f0dceff4fa86c650d1eb05..951bb0d6f020edf4c5ef6a04ccac9c662d2b8dbd 100755 (executable)
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
## 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;