From: Matt Kraai Date: Tue, 16 Dec 2008 07:36:38 GMT Subject: [PATCH] gitweb: pass the option name to the feature callback Message-ID: <1229412998-8385-1-git-send-email-kraai@ftbfs.org> In-Reply-To: <1229408179-7655-1-git-send-email-kraai@ftbfs.org> The feature_bool callback required the option name to be passed to it. Make gitweb_get_feature do so instead of constructing an anonymous subroutine for each overrideable boolean option. Signed-off-by: Matt Kraai --- gitweb/gitweb.perl | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Sorry for the churn; I read the corresponding part of Higher-Order Perl *after* sending my previous patches. :( If I should squash this into my previous patch and resubmit it, please let me know. diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 827e5c5..3459293 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -203,7 +203,7 @@ our %feature = ( # $feature{'blame'}{'override'} = 1; # and in project config gitweb.blame = 0|1; 'blame' => { - 'sub' => sub { feature_bool('blame', @_) }, + 'sub' => \&feature_bool, 'override' => 0, 'default' => [0]}, @@ -241,7 +241,7 @@ our %feature = ( # $feature{'grep'}{'override'} = 1; # and in project config gitweb.grep = 0|1; 'grep' => { - 'sub' => sub { feature_bool('grep', @_) }, + 'sub' => \&feature_bool, 'override' => 0, 'default' => [1]}, @@ -255,7 +255,7 @@ our %feature = ( # $feature{'pickaxe'}{'override'} = 1; # and in project config gitweb.pickaxe = 0|1; 'pickaxe' => { - 'sub' => sub { feature_bool('pickaxe', @_) }, + 'sub' => \&feature_bool, 'override' => 0, 'default' => [1]}, @@ -344,7 +344,7 @@ sub gitweb_get_feature { warn "feature $name is not overrideable"; return @defaults; } - return $sub->(@defaults); + return $sub->($name, @defaults); } # A wrapper to check if a given feature is enabled. @@ -377,9 +377,9 @@ sub feature_bool { } sub feature_snapshot { - my (@fmts) = @_; + my ($key, @fmts) = @_; - my ($val) = git_get_project_config('snapshot'); + my ($val) = git_get_project_config($key); if ($val) { @fmts = ($val eq 'none' ? () : split /\s*[,\s]\s*/, $val); -- 1.5.6.5