Skip to content

Commit

Permalink
gitweb: fix 'ctags' feature check and others
Browse files Browse the repository at this point in the history
gitweb_check_feature() function is to retrieve the configuration parameter
list and calling it in the scalar context does not give its first element
that tells if the feature is enabled.  This fixes all the existing callers
to call the function correctly in the list context.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Dec 1, 2008
1 parent d5cbdba commit 8d2dbba
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -3914,7 +3914,7 @@ sub fill_project_list_info {
my ($projlist, $check_forks) = @_;
my @projects;

my $show_ctags = gitweb_check_feature('ctags');
my ($show_ctags) = gitweb_check_feature('ctags');
PROJECT:
foreach my $pr (@$projlist) {
my (@activity) = git_get_last_activity($pr->{'path'});
Expand Down Expand Up @@ -3988,7 +3988,7 @@ sub git_project_list_body {
@projects = sort {$a->{$oi->{'key'}} <=> $b->{$oi->{'key'}}} @projects;
}

my $show_ctags = gitweb_check_feature('ctags');
my ($show_ctags) = gitweb_check_feature('ctags');
if ($show_ctags) {
my %ctags;
foreach my $p (@projects) {
Expand Down Expand Up @@ -4457,7 +4457,7 @@ sub git_summary {
}

# Tag cloud
my $show_ctags = (gitweb_check_feature('ctags'))[0];
my ($show_ctags) = gitweb_check_feature('ctags');
if ($show_ctags) {
my $ctags = git_get_project_ctags($project);
my $cloud = git_populate_project_tagcloud($ctags);
Expand Down Expand Up @@ -4559,7 +4559,7 @@ sub git_blame {
my $fd;
my $ftype;

gitweb_check_feature('blame')
gitweb_check_feature('blame')[0]
or die_error(403, "Blame view not allowed");

die_error(400, "No file name given") unless $file_name;
Expand Down Expand Up @@ -5610,7 +5610,7 @@ sub git_history {
}

sub git_search {
gitweb_check_feature('search') or die_error(403, "Search is disabled");
gitweb_check_feature('search')[0] or die_error(403, "Search is disabled");
if (!defined $searchtext) {
die_error(400, "Text field is empty");
}
Expand All @@ -5629,11 +5629,11 @@ sub git_search {
if ($searchtype eq 'pickaxe') {
# pickaxe may take all resources of your box and run for several minutes
# with every query - so decide by yourself how public you make this feature
gitweb_check_feature('pickaxe')
gitweb_check_feature('pickaxe')[0]
or die_error(403, "Pickaxe is disabled");
}
if ($searchtype eq 'grep') {
gitweb_check_feature('grep')
gitweb_check_feature('grep')[0]
or die_error(403, "Grep is disabled");
}

Expand Down

0 comments on commit 8d2dbba

Please sign in to comment.