git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCHv2 2/3] cvsimport: fix the parsing of uppercase config options
Date: Sun, 28 Nov 2010 20:39:46 +0100	[thread overview]
Message-ID: <d501b7423a370f9b7f95c8f23c4b6adfc2963643.1290973138.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <4CF2ADC9.8020504@drmicha.warpmail.net>
In-Reply-To: <468f815beeede312f98daa66986ce8bf887724b3.1290973138.git.git@drmicha.warpmail.net>

The current code leads to

fatal: bad config value for 'cvsimport.r' in .git/config

for a standard use case with cvsimport.r set:

cvsimport sets internal variables by checking the config for each
possible command line option. The problem is that config items are case
insensitive, so config.r and config.R are the same. The ugly error is
due to that fact that cvsimport expects a bool for -R (and thus
config.R) but a remote name for -r (and thus config.r).

Fix this by making cvsimport expect the config item "cvsimport.RR"
for the command line option "-R" etc.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 git-cvsimport.perl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 7888b77..736a7bf 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -97,10 +97,12 @@ sub read_repo_config {
 	foreach my $o (@opts) {
 		my $key = $o;
 		$key =~ s/://g;
+		my $ckey = $key;
+		$ckey .= $ckey if ($key eq uc($key));
 		my $arg = 'git config';
 		$arg .= ' --bool' if ($o !~ /:$/);
 
-		chomp(my $tmp = `$arg --get cvsimport.$key`);
+		chomp(my $tmp = `$arg --get cvsimport.$ckey`);
 		if ($tmp && !($arg =~ /--bool/ && $tmp eq 'false')) {
 			no strict 'refs';
 			my $opt_name = "opt_" . $key;
-- 
1.7.3.2.614.g03864.dirty

  reply	other threads:[~2010-11-28 19:39 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 15:10 [PATCH 1/3] cvsimport: partial whitespace cleanup Michael J Gruber
2010-11-25 15:10 ` [PATCH 2/3] cvsimport: fix the parsing of uppercase config options Michael J Gruber
2010-11-27  6:38   ` Junio C Hamano
2010-11-28 19:30     ` Michael J Gruber
2010-11-28 19:39       ` [PATCHv2 1/3] cvsimport: partial whitespace cleanup Michael J Gruber
2010-11-28 19:39         ` Michael J Gruber [this message]
2010-11-28 19:39         ` [PATCHv2 3/3] cvsimport.txt: document the mapping between config and options Michael J Gruber
2010-11-29 20:23           ` Junio C Hamano
2010-11-30  7:56             ` Michael J Gruber
2010-12-01  1:43               ` Junio C Hamano
2010-12-01 12:53                 ` [PATCHv3 0/3] uppercase config options for cvsimport Michael J Gruber
2010-12-01 12:53                   ` [PATCHv3 1/3] cvsimport: partial whitespace cleanup Michael J Gruber
2010-12-01 12:53                   ` [PATCHv3 2/3] cvsimport: fix the parsing of uppercase config options Michael J Gruber
2010-12-01 14:59                     ` Martin Langhoff
2010-12-01 16:05                       ` Jonathan Nieder
2010-12-01 16:18                         ` Martin Langhoff
2010-12-01 16:23                         ` Jakub Narebski
2010-12-01 16:34                           ` Jonathan Nieder
2010-12-01 16:52                             ` Michael J Gruber
2010-12-01 17:01                               ` Jonathan Nieder
2010-12-01 17:58                               ` Jeff King
2010-12-01 19:47                                 ` Junio C Hamano
2010-12-02 21:46                                   ` Junio C Hamano
2010-12-01 17:55                             ` Jeff King
2010-12-01 18:36                               ` [PATCH] add: introduce add.ignoreerrors synonym for add.ignore-errors Jonathan Nieder
2010-12-01 18:46                                 ` Jeff King
2010-12-01 18:57                                   ` Jonathan Nieder
2010-12-01 19:56                                     ` Junio C Hamano
2010-12-01 20:09                                     ` Junio C Hamano
2010-12-01 21:07                                       ` Jeff King
2010-12-03  2:18                                       ` Junio C Hamano
2010-12-01 12:53                   ` [PATCHv3 3/3] cvsimport.txt: document the mapping between config and options Michael J Gruber
2010-12-01 15:02                 ` [PATCHv2 " Martin Langhoff
2010-12-01 15:34                   ` Michael J Gruber
2010-11-25 15:10 ` [PATCH " Michael J Gruber
2010-11-27  6:33 ` [PATCH 1/3] cvsimport: partial whitespace cleanup Junio C Hamano

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

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

  git send-email \
    --in-reply-to=d501b7423a370f9b7f95c8f23c4b6adfc2963643.1290973138.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).