git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Marc Branchaud <marcnarc@xiplink.com>
Cc: git@vger.kernel.org, Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: Re: [RFC/PATCH] Changed gitweb.remote_heads config key name to gitweb.remoteHeads.
Date: Thu, 7 Jul 2011 20:56:24 +0200	[thread overview]
Message-ID: <201107072056.25417.jnareb@gmail.com> (raw)
In-Reply-To: <1310061739-4441-1-git-send-email-marcnarc@xiplink.com>

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.

> ---
> 
> 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(-)

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

  reply	other threads:[~2011-07-07 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-07 18:02 [RFC/PATCH] Changed gitweb.remote_heads config key name to gitweb.remoteHeads Marc Branchaud
2011-07-07 18:56 ` Jakub Narebski [this message]
2011-07-07 20:36   ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201107072056.25417.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=giuseppe.bilotta@gmail.com \
    --cc=marcnarc@xiplink.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).