From: Jeff King <peff@peff.net>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Jakub Narebski <jnareb@gmail.com>,
Martin Langhoff <martin.langhoff@gmail.com>,
Michael J Gruber <git@drmicha.warpmail.net>,
git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCHv3 2/3] cvsimport: fix the parsing of uppercase config options
Date: Wed, 1 Dec 2010 12:55:17 -0500 [thread overview]
Message-ID: <20101201175517.GA7774@sigill.intra.peff.net> (raw)
In-Reply-To: <20101201163406.GD26120@burratino>
On Wed, Dec 01, 2010 at 10:34:06AM -0600, Jonathan Nieder wrote:
> (+cc: Jeff, config parsing wizard)
Ugh, that is not a title that I aspire to. :)
> > Good idea, though I'd rather we avoid new convention for multi word
> > names separated with '-' (multi-word), but rather use camel case
> > (multiWord).
>
> No disagreement there. :)
>
> > Currently we have only unfortunate exception of `add.ignore-errors',
At some point there was talk of making this add.ignoreErrors in the
docs, and just keeping the add.ignore-errors alias forever for backwards
compatibility.
> Maybe we can teach the config file parser to ignore dashes in addition
> to case (except in the names of [genus "species"] headings)? That
> would be an incompatible change for third-party tools, though, so
> maybe "git config" would have to take an explicit --strip-dashes
> flag to do it.
But if you require --strip-dashes, then you get potentially differing
behavior for the same set of options (i.e., one tool may accept "foobar"
but the other requires "foo-bar", because the latter has not been
updated to --strip-dashes).
Naively, such a patch would look like:
diff --git a/builtin/add.c b/builtin/add.c
index 22c6329..944c54f 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -331,7 +331,7 @@ static struct option builtin_add_options[] = {
static int add_config(const char *var, const char *value, void *cb)
{
- if (!strcasecmp(var, "add.ignore-errors")) {
+ if (!strcasecmp(var, "add.ignoreerrors")) {
ignore_add_errors = git_config_bool(var, value);
return 0;
}
diff --git a/config.c b/config.c
index d8ce653..e5cb5f9 100644
--- a/config.c
+++ b/config.c
@@ -211,6 +211,8 @@ static int get_value(config_fn_t fn, void *data, char *name, unsigned int len)
break;
if (!iskeychar(c))
break;
+ if (c == '-')
+ continue;
name[len++] = tolower(c);
if (len >= MAXNAME)
return -1;
but there are a lot of corner cases. What happens with --get-regexp?
What happens with headings like '[foo-bar "baz"]'. When we use
"git-config" to edit, do we properly preserve dashes?
I started to think about all of these things, and then realized it
probably just isn't worth it. If we care about no-dashes, then let's
enforce no-dashes in new options. If we care about the existing
add.ignore-errors, then let's fix it but keep the old version there for
backwards compatibility. Those are easy to do, and then the problem just
goes away.
-Peff
next prev parent reply other threads:[~2010-12-01 17:55 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 ` [PATCHv2 2/3] cvsimport: fix the parsing of uppercase config options Michael J Gruber
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 [this message]
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=20101201175517.GA7774@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jnareb@gmail.com \
--cc=jrnieder@gmail.com \
--cc=martin.langhoff@gmail.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).