git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Jeremy White <jwhite@winehq.org>, git@vger.kernel.org
Subject: Re: [PATCH] Generate a warning message if we find an unrecognized option.
Date: Mon, 08 Feb 2010 16:59:12 -0800	[thread overview]
Message-ID: <7vvde7z0kf.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20100209004514.GB4065@coredump.intra.peff.net> (Jeff King's message of "Mon\, 8 Feb 2010 19\:45\:14 -0500")

Jeff King <peff@peff.net> writes:

> On Mon, Feb 08, 2010 at 04:33:35PM -0600, Jeremy White wrote:
>
>> diff --git a/imap-send.c b/imap-send.c
>> index 51f371b..885da22 100644
>> --- a/imap-send.c
>> +++ b/imap-send.c
>> @@ -1360,6 +1360,7 @@ static int git_imap_config(const char *key, const char *val, void *cb)
>>  		server.ssl_verify = git_config_bool(key, val);
>>  	else if (!strcmp("preformattedHTML", key))
>>  		server.use_html = git_config_bool(key, val);
>> +        else imap_info("Unknown imap configuration option '%s'\n", key);
>>  	return 0;
>>  }
>
> Slight NAK from me on this. When we later add new options, it makes
> using the same config for multiple versions of git difficult (the old
> versions will complain about the unknown option).
>
> And obviously that is weighed against the ability to notice things like
> typos. But if we are going to start complaining about unknown config, we
> would probably do better to complain about _all_ unknown config, and not
> just this one subsection.

We would probably want something like:

	static int do_warn_unknown_config;

	void warn_unknown_config(const char *key)
        {
		if (do_warn_unknown_config)
                	warn("Unknown configuration variable %s", key);
        }

and sprinkle that everywhere.

An interesting issue is where to flip do_warn_unknown_config.  A naïve
and obvious implementation would do:

        static int git_default_core_config(const char *var, const char *value)
        {
		...
		if (!strcmp(var, "core.warnunknownconfig")) {
			do_warn_unknown_config = git_config_bool(var, value);
			return 0;
		}
		...
	}

but that means the definition of this variable has to come very early in
the configuration file to be effective.

  reply	other threads:[~2010-02-09  0:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08 22:33 [PATCH] Generate a warning message if we find an unrecognized option Jeremy White
2010-02-09  0:45 ` Jeff King
2010-02-09  0:59   ` Junio C Hamano [this message]
2010-02-09  3:01     ` Jeff King
2010-02-09  5:17       ` David Aguilar
2010-02-09  5:59         ` Jeff King

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=7vvde7z0kf.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jwhite@winehq.org \
    --cc=peff@peff.net \
    /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).