From: Junio C Hamano Date: Sat, 29 Nov 2008 21:02:08 +0000 (-0800) Subject: gitweb: rename gitweb_check_feature to gitweb_get_feature X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/d3e08ba9e617ee5744f1550d5cf6bcb863bc40ee13cb5f14b91983a0602dad17 gitweb: rename gitweb_check_feature to gitweb_get_feature The function is about retrieving the configuration parameter list for the feature. A more robust way to check if a feature is enabled will be introduced in the next patch, and the function will be called gitweb_check_feature. Signed-off-by: Junio C Hamano --- diff --git a/gitweb.perl b/gitweb.perl index d1c345f..a0cdd4b 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -191,7 +191,7 @@ our %feature = ( # if there is no 'sub' key (no feature-sub), then feature cannot be # overriden # - # use gitweb_check_feature() to check if is enabled + # # Enable the 'blame' blob view, showing the last commit that modified # each line in the file. This can be very CPU-intensive. @@ -330,7 +330,7 @@ our %feature = ( 'default' => [0]}, ); -sub gitweb_check_feature { +sub gitweb_get_feature { my ($name) = @_; return unless exists $feature{$name}; my ($sub, $override, @defaults) = ( @@ -768,7 +768,7 @@ our $git_dir; $git_dir = "$projectroot/$project" if $project; # list of supported snapshot formats -our @snapshot_fmts = gitweb_check_feature('snapshot'); +our @snapshot_fmts = gitweb_get_feature('snapshot'); @snapshot_fmts = filter_snapshot_fmts(@snapshot_fmts); # dispatch @@ -811,7 +811,7 @@ sub href (%) { } } - my ($use_pathinfo) = gitweb_check_feature('pathinfo'); + my ($use_pathinfo) = gitweb_get_feature('pathinfo'); if ($use_pathinfo) { # try to put as many parameters as possible in PATH_INFO: # - project name @@ -2102,7 +2102,7 @@ sub git_get_projects_list { $filter ||= ''; $filter =~ s/\.git$//; - my ($check_forks) = gitweb_check_feature('forks'); + my ($check_forks) = gitweb_get_feature('forks'); if (-d $projects_list) { # search in directory @@ -2948,7 +2948,7 @@ EOF } print "\n"; - my ($have_search) = gitweb_check_feature('search'); + my ($have_search) = gitweb_get_feature('search'); if (defined $project && $have_search) { if (!defined $searchtext) { $searchtext = ""; @@ -2962,7 +2962,7 @@ EOF $search_hash = "HEAD"; } my $action = $my_uri; - my ($use_pathinfo) = gitweb_check_feature('pathinfo'); + my ($use_pathinfo) = gitweb_get_feature('pathinfo'); if ($use_pathinfo) { $action .= "/".esc_url($project); } @@ -3085,7 +3085,7 @@ sub git_print_page_nav { $arg{'tree'}{'hash'} = $treehead if defined $treehead; $arg{'tree'}{'hash_base'} = $treebase if defined $treebase; - my @actions = gitweb_check_feature('actions'); + my @actions = gitweb_get_feature('actions'); my %repl = ( '%' => '%', 'n' => $project, # project name @@ -3455,7 +3455,7 @@ sub is_patch_split { sub git_difftree_body { my ($difftree, $hash, @parents) = @_; my ($parent) = $parents[0]; - my ($have_blame) = gitweb_check_feature('blame'); + my ($have_blame) = gitweb_get_feature('blame'); print "
\n"; if ($#{$difftree} > 10) { print(($#{$difftree} + 1) . " files changed:\n"); @@ -3915,7 +3915,7 @@ sub fill_project_list_info { my ($projlist, $check_forks) = @_; my @projects; - my ($show_ctags) = gitweb_check_feature('ctags'); + my ($show_ctags) = gitweb_get_feature('ctags'); PROJECT: foreach my $pr (@$projlist) { my (@activity) = git_get_last_activity($pr->{'path'}); @@ -3969,7 +3969,7 @@ sub git_project_list_body { # actually uses global variable $project my ($projlist, $order, $from, $to, $extra, $no_header) = @_; - my ($check_forks) = gitweb_check_feature('forks'); + my ($check_forks) = gitweb_get_feature('forks'); my @projects = fill_project_list_info($projlist, $check_forks); $order ||= $default_projects_order; @@ -3989,7 +3989,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_get_feature('ctags'); if ($show_ctags) { my %ctags; foreach my $p (@projects) { @@ -4429,7 +4429,7 @@ sub git_summary { my @taglist = git_get_tags_list(16); my @headlist = git_get_heads_list(16); my @forklist; - my ($check_forks) = gitweb_check_feature('forks'); + my ($check_forks) = gitweb_get_feature('forks'); if ($check_forks) { @forklist = git_get_projects_list($project); @@ -4458,7 +4458,7 @@ sub git_summary { } # Tag cloud - my ($show_ctags) = gitweb_check_feature('ctags'); + my ($show_ctags) = gitweb_get_feature('ctags'); if ($show_ctags) { my $ctags = git_get_project_ctags($project); my $cloud = git_populate_project_tagcloud($ctags); @@ -4560,7 +4560,7 @@ sub git_blame { my $fd; my $ftype; - gitweb_check_feature('blame')[0] + gitweb_get_feature('blame')[0] or die_error(403, "Blame view not allowed"); die_error(400, "No file name given") unless $file_name; @@ -4748,7 +4748,7 @@ sub git_blob { $expires = "+1d"; } - my ($have_blame) = gitweb_check_feature('blame'); + my ($have_blame) = gitweb_get_feature('blame'); open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash or die_error(500, "Couldn't cat $file_name, $hash"); my $mimetype = blob_mimetype($fd, $file_name); @@ -4841,7 +4841,7 @@ sub git_tree { my $ref = format_ref_marker($refs, $hash_base); git_header_html(); my $basedir = ''; - my ($have_blame) = gitweb_check_feature('blame'); + my ($have_blame) = gitweb_get_feature('blame'); if (defined $hash_base && (my %co = parse_commit($hash_base))) { my @views_nav = (); if (defined $file_name) { @@ -5611,7 +5611,7 @@ sub git_history { } sub git_search { - gitweb_check_feature('search')[0] or die_error(403, "Search is disabled"); + gitweb_get_feature('search')[0] or die_error(403, "Search is disabled"); if (!defined $searchtext) { die_error(400, "Text field is empty"); } @@ -5630,11 +5630,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')[0] + gitweb_get_feature('pickaxe')[0] or die_error(403, "Pickaxe is disabled"); } if ($searchtype eq 'grep') { - gitweb_check_feature('grep')[0] + gitweb_get_feature('grep')[0] or die_error(403, "Grep is disabled"); } @@ -5839,7 +5839,7 @@ insensitive).

commit
The commit messages and authorship information will be scanned for the given pattern.
EOT - my ($have_grep) = gitweb_check_feature('grep'); + my ($have_grep) = gitweb_get_feature('grep'); if ($have_grep) { print <grep @@ -5856,7 +5856,7 @@ EOT
committer
Name and e-mail of the committer and date of commit will be scanned for the given pattern.
EOT - my ($have_pickaxe) = gitweb_check_feature('pickaxe'); + my ($have_pickaxe) = gitweb_get_feature('pickaxe'); if ($have_pickaxe) { print <pickaxe @@ -5908,7 +5908,7 @@ sub git_shortlog { sub git_feed { my $format = shift || 'atom'; - my ($have_blame) = gitweb_check_feature('blame'); + my ($have_blame) = gitweb_get_feature('blame'); # Atom: http://www.atomenabled.org/developers/syndication/ # RSS: http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ