public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail•com>
To: Junio C Hamano <gitster@pobox•com>
Cc: Stefan Hajnoczi <stefanha@gmail•com>,
	git@vger•kernel.org, Michael J Gruber <git@drmicha•warpmail.net>
Subject: Re: Local unset override global options
Date: Mon, 12 Apr 2010 23:07:21 +0200	[thread overview]
Message-ID: <201004122307.22836.jnareb@gmail.com> (raw)
In-Reply-To: <7vvdbwk004.fsf@alter.siamese.dyndns.org>

Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail•com> writes:
> 
> > Junio C Hamano wrote:
> >> Jakub Narebski <jnareb@gmail•com> writes:
> >> 
> >> > How does special case of no value, i.e.
> >> >
> >> >    [sendemail]
> >> >         smtpuser
> >> 
> >> That is not a special case; that is "boolean true".
> >
> > Well, it is "boolean true" *if* git-config is used with '--bool'.
> >
> > If git-send-email.perl used "git config -l -z" to read all its config 
> > variables at once into hash, like gitweb.perl does in the 
> > git_parse_project_config() subroutine, it would be able to distinguish 
> > between those the case of no value:
> >
> >     [sendemail]
> >          smtpuser
> 
> If sendemail is ever re-written in C and use git_config() API, the above
> will become boolean.

Isn't this only for git_config_bool and the like... oh, I see that
git_config_string does not consider no value case proper string value,
and warns that it is suitable only for boolean variables:

   if (!value)
                return config_error_nonbool(var);

> Besides, even if you are sticking to sendemail.perl 
> forever, you are still inventing another convention that "boolean true
> means no I don't want it".  And it is clearly a lot less intuitive than
> "empty means no I don't want it", isn't it?

True, after thinking a bit about this using no value to unset is 
a horrible, horrible hack.  git-send-email should be corrected to not
only check that there is value from config or command line option, but
also that it is sane (i.e. non-empty, or simply true-ish if we say
that smtpuser = "0" is not something we need to worry about supporting).


About ORIGINAL problem: I think it can be done by setting different
identities, and just switching them using sendemail.identity; for some
of those identities sendemail.<identity>.smtpuser can be not set.

-- 
Jakub Narebski
Poland

  parent reply	other threads:[~2010-04-12 21:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-10  6:54 Local unset override global options Stefan Hajnoczi
2010-04-12  8:13 ` Michael J Gruber
2010-04-12  8:23   ` Stefan Hajnoczi
2010-04-12  8:28     ` Michael J Gruber
2010-04-12  8:53       ` Jakub Narebski
2010-04-12 15:47         ` Junio C Hamano
2010-04-12 17:02           ` Jakub Narebski
2010-04-12 18:18             ` Junio C Hamano
2010-04-12 18:36               ` Erik Faye-Lund
2010-04-12 21:07               ` Jakub Narebski [this message]
2010-04-12  8:35   ` Junio C Hamano
2010-04-12  8:43     ` Stefan Hajnoczi
2010-04-12 15:48       ` Junio C Hamano
2010-04-12 16:07         ` Stefan Hajnoczi

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=201004122307.22836.jnareb@gmail.com \
    --to=jnareb@gmail$(echo .)com \
    --cc=git@drmicha$(echo .)warpmail.net \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=stefanha@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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