git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Local unset override global options

From
Jakub Narebski <jnareb@gmail.com>
Date
Apr 12, 2010, 21:07 UTC
Message-ID
<201004122307.22836.jnareb@gmail.com>
In-Reply-To
<7vvdbwk004.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 24 quoted lines
> 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
Previous: Erik Faye-LundNext: Junio C Hamano
Message 10 of 14 in “Local unset override global options”
  1. Stefan HajnocziApr 10, 2010
  2. Michael J GruberApr 12, 2010
  3. Stefan HajnocziApr 12, 2010
  4. Michael J GruberApr 12, 2010
  5. Jakub NarebskiApr 12, 2010
  6. Junio C HamanoApr 12, 2010
  7. Jakub NarebskiApr 12, 2010
  8. Junio C HamanoApr 12, 2010
  9. Erik Faye-LundApr 12, 2010
  10. Jakub NarebskiApr 12, 2010
  11. Junio C HamanoApr 12, 2010
  12. Stefan HajnocziApr 12, 2010
  13. Junio C HamanoApr 12, 2010
  14. Stefan HajnocziApr 12, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.