git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitweb: merge boolean feature subroutines
@ 2009-01-03 15:31 Matt Kraai
  2009-01-03 15:31 ` [PATCH] gitweb: pass the key to the " Matt Kraai
  2009-01-03 16:18 ` [PATCH] gitweb: merge boolean " demerphq
  0 siblings, 2 replies; 12+ messages in thread
From: Matt Kraai @ 2009-01-03 15:31 UTC (permalink / raw)
  To: git; +Cc: Matt Kraai

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
---
 gitweb/gitweb.perl |   35 ++++++-----------------------------
 1 files changed, 6 insertions(+), 29 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 99f71b4..4ba2a9b 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' => \&feature_blame,
+		'sub' => sub { feature_bool('blame', @_) },
 		'override' => 0,
 		'default' => [0]},
 
@@ -241,7 +241,7 @@ our %feature = (
 	# $feature{'grep'}{'override'} = 1;
 	# and in project config gitweb.grep = 0|1;
 	'grep' => {
-		'sub' => \&feature_grep,
+		'sub' => sub { feature_bool('grep', @_) },
 		'override' => 0,
 		'default' => [1]},
 
@@ -255,7 +255,7 @@ our %feature = (
 	# $feature{'pickaxe'}{'override'} = 1;
 	# and in project config gitweb.pickaxe = 0|1;
 	'pickaxe' => {
-		'sub' => \&feature_pickaxe,
+		'sub' => sub { feature_bool('pickaxe', @_) },
 		'override' => 0,
 		'default' => [1]},
 
@@ -363,8 +363,9 @@ sub gitweb_check_feature {
 }
 
 
-sub feature_blame {
-	my ($val) = git_get_project_config('blame', '--bool');
+sub feature_bool {
+	my $key = shift;
+	my ($val) = git_get_project_config($key, '--bool');
 
 	if ($val eq 'true') {
 		return 1;
@@ -387,30 +388,6 @@ sub feature_snapshot {
 	return @fmts;
 }
 
-sub feature_grep {
-	my ($val) = git_get_project_config('grep', '--bool');
-
-	if ($val eq 'true') {
-		return (1);
-	} elsif ($val eq 'false') {
-		return (0);
-	}
-
-	return ($_[0]);
-}
-
-sub feature_pickaxe {
-	my ($val) = git_get_project_config('pickaxe', '--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.
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-01-04 22:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-03 15:31 [PATCH] gitweb: merge boolean feature subroutines Matt Kraai
2009-01-03 15:31 ` [PATCH] gitweb: pass the key to the " Matt Kraai
2009-01-03 16:18 ` [PATCH] gitweb: merge boolean " demerphq
2009-01-03 16:40   ` Matt Kraai
2009-01-03 16:51     ` demerphq
2009-01-03 17:13       ` Matt Kraai
2009-01-03 17:41         ` demerphq
2009-01-04  5:30   ` Junio C Hamano
2009-01-04 11:41     ` demerphq
2009-01-04 15:58       ` Matt Kraai
2009-01-04 22:07         ` Jakub Narebski
2009-01-04 21:25       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).