git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitweb: gitweb_check_feature always return list

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 1, 2006, 19:31 UTC
Message-ID
<11571390683018-git-send-email-jnareb@gmail.com>
In-Reply-To
<ed8a90$pfn$1@sea.gmane.org>

Modified feature_blame so it returns one-element list and not scalar, thus making gitweb_check_feature always return list. Updated comment to explain that part.

This is continuation of Aneesh Kumar work:
  gitweb: Fix git_blame
"Converting the default values to array broke the git blame enable
 disable support. Fix the same."
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
We could modify %feature hash so the 'default' value could be either
array reference or a scalar instead.
 gitweb/gitweb.perl |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 57ffa25..06bdb0e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -74,9 +74,12 @@ our %feature = (
 	#
 	# if feature is overridable (it means that allow-override has true value,
 	# then feature-sub will be called with default options as parameters;
-	# return value of feature-sub indicates if to enable specified feature
+	# return value of feature-sub indicates if to enable specified feature,
+	# and is taken to be current parameters of the feature
 	#
-	# use gitweb_check_feature(<feature>) to check if <feature> is enabled
+	# use gitweb_check_feature(<feature>) to check if <feature> is enabled;
+	# to be more exact to get current parameters of <feature>;
+	# gitweb_check_feature(<feature>) returns array (list) of current options
 
 	'blame' => {
 		'sub' => \&feature_blame,
@@ -111,12 +114,12 @@ sub feature_blame {
 	my ($val) = git_get_project_config('blame', '--bool');
 
 	if ($val eq 'true') {
-		return 1;
+		return (1);
 	} elsif ($val eq 'false') {
-		return 0;
+		return (0);
 	}
 
-	return $_[0];
+	return ($_[0]);
 }
 
 # To disable system wide have in $GITWEB_CONFIG
-- 
1.4.1.1
Previous: Jakub NarebskiNext: Junio C Hamano
Message 3 of 6 in “gitweb: Fix git_blame”
  1. gitweb: Fix git_blameAneesh Kumar K.V, Sep 1, 2006
  2. Jakub NarebskiSep 1, 2006
  3. gitweb: gitweb_check_feature always return listJakub Narebski, Sep 1, 2006
  4. Junio C HamanoSep 1, 2006
  5. Jakub NarebskiSep 1, 2006
  6. Jakub NarebskiSep 1, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.