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

[PATCH 0/3] Re: git config --get-urlmatch does not set exit code 1 when no match is found

From
John Keeping <john@keeping.me.uk>
Date
Feb 28, 2016, 11:54 UTC
Message-ID
<cover.1456660027.git.john@keeping.me.uk>
In-Reply-To
<20160228104557.GT1766@serenity.lan>
On Sun, Feb 28, 2016 at 10:45:57AM +0000, John Keeping wrote:
Show 28 quoted lines
> It looks to me like a simple bug that --get-urlmatch doesn't return 1 if
> the key isn't found, but git-config(1) isn't entirely clear.  The
> overall documentation on exit codes at the end of DESCRIPTION says that
> exit code 1 means:
> 
>       the section or key is invalid (ret=1)
> 
> Then the documentation for the --get option says:
> 
>       Returns error code 1 if the key was not found.
> 
> and --get-all says:
> 
>       Like get, but does not fail if the number of values for the key
>       is not exactly one.
> 
> although it does return 1 if there are zero values.  --get-regexp
> behaves in the same way.
> 
> Overall I think that the fact that --get-urlmatch is the outlier here
> means that it should change to match the other --get* options (ignoring
> --get-color and --get-colorbool which are very different).  Although I
> wonder if anyone is relying on the current behaviour and will find their
> workflow broken if we change this.
> 
> The documentation could also use some clarification since most of the
> return codes only apply for the "set" options and in some cases this
> isn't clear from the existing descriptions.

Here's a series that changes the behaviour of "git config --get-urlmatch" when no appropriate key is found as well as a couple of improvements to the documentation while we're here.

The second two patches are independent of the first and I think they should be picked up even if we decide the change to --get-urlmatch's exit code is not desirable.

John Keeping (3):
  config: fail if --get-urlmatch finds no value
  Documentation/git-config: use bulleted list for exit codes
  Documentation/git-config: fix --get-all description
 Documentation/git-config.txt | 19 +++++++++----------
 builtin/config.c             |  5 ++++-
 t/t1300-repo-config.sh       |  3 +++
 3 files changed, 16 insertions(+), 11 deletions(-)
-- 
2.7.1.503.g3cfa3ac
Previous: John KeepingNext: John Keeping
Message 4 of 11 in “git config --get-urlmatch does not set exit code 1 when no match is found”
  1. GuilhermeFeb 28, 2016
  2. John KeepingFeb 28, 2016
  3. John KeepingFeb 28, 2016
  4. 0/3 Re: git config --get-urlmatch does not set exit code 1 when no match is foundJohn Keeping, Feb 28, 2016
  5. 1/3 config: fail if --get-urlmatch finds no valueJohn Keeping, Feb 28, 2016
  6. 2/3 Documentation/git-config: use bulleted list for exit codesJohn Keeping, Feb 28, 2016
  7. 3/3 Documentation/git-config: fix --get-all descriptionJohn Keeping, Feb 28, 2016
  8. Junio C HamanoFeb 28, 2016
  9. Jeff KingFeb 29, 2016
  10. GuilhermeFeb 29, 2016
  11. Jeff KingMar 1, 2016

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.