git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j.sixt@viscovery.net>,
	Pierre Habouzit <madcoder@debian.org>,
	Git ML <git@vger.kernel.org>
Subject: Re: [bug] generic issue with git_config handlers
Date: Thu, 7 Feb 2008 06:45:23 +0100	[thread overview]
Message-ID: <200802070645.23840.chriscool@tuxfamily.org> (raw)
In-Reply-To: <7vk5lki815.fsf@gitster.siamese.dyndns.org>

Le mardi 5 février 2008, Junio C Hamano a écrit :
> Christian Couder <chriscool@tuxfamily.org> writes:
> > Very unfortunate.
> >
> > I finally had the following patch that passed all tests (it changed
> > only one test), in case someone wants to suggest that we change
> > git_config_bool, hint, hint!
>
> Sorry, I do not get what you are hinting at. 

Well, I wanted someone else to suggest that we deprecate using "" as a 
boolean false.

Something like this (completely untested) :

diff --git a/config.c b/config.c
index 526a3f4..44afeaa 100644
--- a/config.c
+++ b/config.c
@@ -300,8 +300,19 @@ int git_config_bool(const char *name, const char 
*value)
 {
        if (!value)
                return 1;
-       if (!*value)
+       if (!*value) {
+               fprintf(stderr,
+                       "Warning: using an empty value for boolean config "
+                       "variables is deprecated.\n"
+                       "An empty value currently means 'false' as a "
+                       "boolean, but may very well means 'true' in the "
+                       "future!\n"
+                       "Please consider using a 'false' value explicitely "
+                       "for variable '%s', so that your config is future "
+                       "proof. You can do that using:\n"
+                       "\tgit config %s false\n", name, name)
                return 0;
+       }
        if (!strcasecmp(value, "true") || !strcasecmp(value, "yes"))
                return 1;
        if (!strcasecmp(value, "false") || !strcasecmp(value, "no"))

So that in a future version we can use "" internaly for both no value and 
empty value variables and consider them meaning the same.

> The fact that you
> passed all the tests suggests that we have a gap in the test
> coverage for these two, so you are inviting more tests from
> others?

I just sent a patch to close this gap.

[...]

> Your "builtin-config.c" patch looks better than before (which
> would segfault), but I think
>
> 	$ git config --bool --list
>
> could pay attention to the "type" thing set earlier, just like
> show_config() does.

I didn't try this, but I will.

Thanks,
Christian.

      reply	other threads:[~2008-02-07  5:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31  9:16 [bug] generic issue with git_config handlers Pierre Habouzit
2008-01-31  9:25 ` Junio C Hamano
2008-01-31 10:10   ` Pierre Habouzit
2008-02-04  6:27     ` Christian Couder
2008-02-04 17:01       ` Johannes Sixt
2008-02-04 23:13         ` Christian Couder
2008-02-05  0:03           ` Junio C Hamano
2008-02-07  5:45             ` Christian Couder [this message]

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=200802070645.23840.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=madcoder@debian.org \
    /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).