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

Re: [PATCH 1/2] config: define and document exit codes

From
Junio C Hamano <gitster@pobox.com>
Date
May 18, 2011, 15:41 UTC
Message-ID
<7vfwocc8z5.fsf@alter.siamese.dyndns.org>
In-Reply-To
<6301052eb455e9088e50f78760e6ca1b9499564a.1305646709.git.git@drmicha.warpmail.net>
Michael J Gruber <git@drmicha.warpmail.net> writes:
Show 10 quoted lines
> +This command will fail (with exit code ret) if:
> +
> +. The config file is invalid (ret=3),
> +. can not write to the config file (ret=4),
> +. no section or name was provided (ret=2),
> +. the section or key is invalid (ret=1),
> +. you try to unset an option which does not exist (ret=5),
> +. you try to unset/set an option for which multiple lines match (ret=5),
> +. you try to use an invalid regexp (ret=6), or
> +. you use '--global' option without $HOME being properly set (ret=128).
I wonder if you want to sort this in the order of return codes.
Show 9 quoted lines
> +/* git_config_parse_key() returns these negated: */
> +#define CONFIG_INVALID_KEY 1
> +#define CONFIG_NO_SECTION_OR_NAME 2
> +/* git_config_set(), git_config_set_multivar() return the above or these: */
> +#define CONFIG_NO_LOCK -1
> +#define CONFIG_INVALID_FILE 3
> +#define CONFIG_NO_WRITE 4
> +#define CONFIG_NOTHING_SET 5
> +#define CONFIG_INVALID_PATTERN 6

Symbols "CONFIG_FOO" looks too much like they are about the feature set chosen when compiling git, at least to me. But I do not think of a better naming scheme ("CONFIG_ERR_FOO" may be a slight improvement but not good enough improvement for the price we pay by having such long symbol names).

By the way, Are you still interested in "diff --stat-count" topic, or have you abandoned it?

Previous: Jeff KingNext: Michael J Gruber
Message 9 of 11 in “config: Give error message when not changing a multivar”
  1. config: Give error message when not changing a multivarMichael J Gruber, May 17, 2011
  2. Jeff KingMay 17, 2011
  3. Michael J GruberMay 17, 2011
  4. Jeff KingMay 17, 2011
  5. 1/2 config: define and document exit codesMichael J Gruber, May 17, 2011
  6. Thiago FarinaMay 17, 2011
  7. Michael J GruberMay 17, 2011
  8. Jeff KingMay 18, 2011
  9. Junio C HamanoMay 18, 2011
  10. Michael J GruberMay 18, 2011
  11. 2/2 config: Give error message when not changing a multivarMichael J Gruber, May 17, 2011

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.