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

Re: Local unset override global options

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 12, 2010, 15:48 UTC
Message-ID
<7vtyrgllje.fsf@alter.siamese.dyndns.org>
In-Reply-To
<r2vfbd9d3991004120143td6f90410j60c7c002b15d5db6@mail.gmail.com>
Stefan Hajnoczi <stefanha@gmail.com> writes:
> That would work but introduces a special case for smtpuser.  Do you
> think users may wish to unset override other options too?

I would indeed agree "users may _wish_ to", but that does not matter as much as "users _need_ to, otherwise they cannot do X and Y and Z".

You seem to think from the beginning of this thread that "empty means I don't want it" is a hacky special case that is limited to this smtpuser variable, but I do not share that view. Not at all.

In fact, "empty means I don't want it" is a very common convention even outside the context of git. Make's use of its variables is a good example. Many people's shell scripts tend to treat an empty variable and an unset variable the same way. The language itself does distinguish an empty and an unset variable, but the colon form of ${var:-something} was invented in addition to the more old fashioned ${var-something} exactly because "empty means unset" is so common. Perl (run without -w/strict) is the same way and undef becomes empty string by default and you need to actively check defined($var) if you care about the difference. Etc. etc.

There are two rather big reasons we would want to stick to the current format without introducing "unset". At least we would want to try to until we find real need that justifies such a change.

 - We could introduce a backward incompatible change to the configuration
   file format to say "This variable is not set at all", but once somebody
   starts using the syntax in his .git/config (or worse $HOME/.gitconfig),
   that repository cannot be used by older version of git anymore.
 - Also internally our variables are never "unset".  Behaviour of a
   plumbing or Porcelain command implemented in C is controlled by
   variables in C, and the contents of the configuration files overwrite
   these variables as they are parsed from the least specific (system) to
   the most specific.  The best you can do is "reset to default" (not
   "unset"), and even that involves fair amount of change.
Previous: Stefan HajnocziNext: Stefan Hajnoczi
Message 13 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.