threads / rfc / 27771

RFC patchChanged gitweb.remote_heads config key name to gitweb.remoteHeads.

Subject: [RFC/PATCH] Changed gitweb.remote_heads config key name to gitweb.remoteHeads.

## tl;dr

3 messages between Jul 7, 2011 and Jul 7, 2011. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Marc Branchaud· Jul 7, 2011, 18:02 UTC · lore
Git doesn't accept config key names with underscore characters.
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
---

Came across this today. The patch is RFC because I have not verified if it's complete or if gitweb even respects the setting.

 gitweb/gitweb.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Show changes to gitweb/gitweb.perl +2 −2
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 81dacf2..edbb080 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -524,9 +524,9 @@ our %feature = (
 	# $feature{'remote_heads'}{'default'} = [1];
 	# To have project specific config enable override in $GITWEB_CONFIG
 	# $feature{'remote_heads'}{'override'} = 1;
-	# and in project config gitweb.remote_heads = 0|1;
+	# and in project config gitweb.remoteHeads = 0|1;
 	'remote_heads' => {
-		'sub' => sub { feature_bool('remote_heads', @_) },
+		'sub' => sub { feature_bool('remoteHeads', @_) },
 		'override' => 0,
 		'default' => [0]},
 );
-- 
1.7.6
Jakub Narebski· Jul 7, 2011, 18:56 UTC · re: Marc Branchaud · lore

Re: [RFC/PATCH] Changed gitweb.remote_heads config key name to gitweb.remoteHeads.

On Thu, 7 Jul 2011, Marc Branchaud wrote:
> Git doesn't accept config key names with underscore characters.

Hmmm... that is strange. Git accepts '-' (though it is discouraged) but not '_' in config key names.

> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>

With the caveat that included patch must be applied first, see below.

Show 18 quoted lines
> ---
> 
> Came across this today.  The patch is RFC because I have not verified 
> if it's complete or if gitweb even respects the setting.
> 
>  gitweb/gitweb.perl |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 81dacf2..edbb080 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -524,9 +524,9 @@ our %feature = (
>  	# $feature{'remote_heads'}{'default'} = [1];
>  	# To have project specific config enable override in $GITWEB_CONFIG
>  	# $feature{'remote_heads'}{'override'} = 1;
> -	# and in project config gitweb.remote_heads = 0|1;
> +	# and in project config gitweb.remoteHeads = 0|1;
Key names are case insensitive...
>  	'remote_heads' => {
> -		'sub' => sub { feature_bool('remote_heads', @_) },
> +		'sub' => sub { feature_bool('remoteHeads', @_) },

...but git_get_project_config didn't respect that. With above, and without included patch, gitweb would get from "git config --list -z" 'gitweb.remoteheads' (turned lowercase), but as it is written here it would check if 'gitweb.remoreHeads' key exists... so it would never match.

-- >8 --
From: Jakub Narebski <jnareb@gmail.com>
Date: Thu, 7 Jul 2011 20:48:50 +0200
Subject: [PATCH] gitweb: Make git config search case insensitive

Gitweb does not (yet?) use git config variables with subsection, so we can simply lowercase $key in git_get_project_config: section name and key name are case insensitive (only subsection name is case sensitive).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
 gitweb/gitweb.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Show changes to gitweb/gitweb.perl +1 −0
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 589c85b..59147b6 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2526,6 +2526,7 @@ sub git_get_project_config {
 
 	# key sanity check
 	return unless ($key);
+	$key = lc($key); # assuming there is no subsection
 	$key =~ s/^gitweb\.//;
 	return if ($key =~ m/\W/);
 
-- 
1.7.5
Jakub Narebski· Jul 7, 2011, 20:36 UTC · re: Jakub Narebski · lore

Re: [RFC/PATCH] Changed gitweb.remote_heads config key name to gitweb.remoteHeads.

> -- >8 --
> From: Jakub Narebski <jnareb@gmail.com>
> Date: Thu, 7 Jul 2011 20:48:50 +0200
> Subject: [PATCH] gitweb: Make git config search case insensitive
I should have probably add here the following:
  The section and key part of fully qualified name of config variable
  are case insensitive in git.  "git config --list -z" that gitweb uses
  returns them lowercased.
 
Show 7 quoted lines
> Gitweb does not (yet?) use git config variables with subsection, so we
> can simply lowercase $key in git_get_project_config: section name and
> key name are case insensitive (only subsection name is case
> sensitive).
> 
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
Yet another case where commit message is longer than fix... ;-)
Show 19 quoted lines
>  gitweb/gitweb.perl |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 589c85b..59147b6 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -2526,6 +2526,7 @@ sub git_get_project_config {
>  
>  	# key sanity check
>  	return unless ($key);
> +	$key = lc($key); # assuming there is no subsection
>  	$key =~ s/^gitweb\.//;
>  	return if ($key =~ m/\W/);
>  
> -- 
> 1.7.5
> 
> 
-- 
Jakub Narebski
Poland

← back to recent threads