Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx> --- gitweb/gitweb.perl | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 65953db..6514bef 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -271,6 +271,18 @@ our %feature = ( 'forks' => { 'override' => 0, 'default' => [0]}, + + # Make gitweb show remotes too in the heads list + + # To enable system wide have in $GITWEB_CONFIG + # $feature{'remote_heads'}{'default'} = [1]; + # To have project specific config enable override in $GITWEB_CONFIG + # $feature{'remote_heads'}{'override'} = 1; + # and in project config gitweb.remote_heads = 0|1; + 'remote_heads' => { + 'sub' => \&feature_remote_heads, + 'override' => 0, + 'default' => [0]}, ); sub gitweb_check_feature { @@ -336,6 +348,18 @@ sub feature_pickaxe { return ($_[0]); } +sub feature_remote_heads { + my ($val) = git_get_project_config('remote_heads', '--bool'); + + if ($val eq 'true') { + return (1); + } elsif ($val eq 'false') { + return (0); + } + + return ($_[0]); +} + # checking HEAD file with -e is fragile if the repository was # initialized long time ago (i.e. symlink HEAD) and was pack-ref'ed # and then pruned. @@ -2060,10 +2084,12 @@ sub git_get_heads_list { my $limit = shift; 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', 'refs/remotes' + 'refs/heads', ( $remote_heads ? 'refs/remotes' : '') or return; while (my $line = <$fd>) { my %ref_item; -- 1.5.2.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