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

Re: git config error message

From
ABAngelo Borsotti <angelo.borsotti@gmail.com>
Date
Oct 27, 2012, 10:36 UTC
Message-ID
<CAB9Jk9COSZOske5xzgnE=1oHe7qiwwOzHYE6pJkuZ0sZyZYhng@mail.gmail.com>
In-Reply-To
<CAP30j15pUwX9sD3FXAfroxFK9paHmb1eAg+M5YAHT4aB22DBEw@mail.gmail.com>
Hi Ben
> This still wouldn't be an error condition though, especially in terms
> of how "git config" should treat it.
The man page says:
   "This command will fail with non-zero status upon error."

Of course, one might claim that this does not mean the truth of the reverse condition, i.e. that when the command returns 1 that is necessarily an error, but I would leave that avenue of thinking to philosophers. Besides that, it is common practice in *nix OSs to consider a return != 0 as an error.

Show 8 quoted lines
> It should be up to the consumer
> of the information to display, or not, any error or diagnostics that
> don't result from either a bad request (your first case) or a
> malformed configuration file.  This fits with the callback nature of
> how the config file is parsed by builtin tools.  The exit code from
> "git config" with a missing key is enough for the consumer to make
> this decision.
>

A well-behaved, user-friendly program, when detects an error tells the user what went wrong. How can otherwise the user tell a corrupted configuration file from a missing key?

Of course, is is possible to provide a git-config that simply returns 0 when it has got the key and 1 when it does not, without issuing any error message, but the current one is not like that, it is a middle way solution.

-Angelo
Previous: Ben WaltonNext: Andreas Schwab
Message 6 of 9 in “git config error message”
  1. Angelo BorsottiOct 27, 2012
  2. Andreas SchwabOct 27, 2012
  3. Angelo BorsottiOct 27, 2012
  4. Andreas SchwabOct 27, 2012
  5. Ben WaltonOct 27, 2012
  6. Angelo BorsottiOct 27, 2012
  7. Andreas SchwabOct 27, 2012
  8. Angelo BorsottiOct 27, 2012
  9. Andreas SchwabOct 27, 2012

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.