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

Re: [PATCHv3 1/2] config: add '--names-only' option to list only variable names

From
Jeff King <peff@peff.net>
Date
Aug 10, 2015, 13:41 UTC
Message-ID
<20150810134124.GA6763@sigill.intra.peff.net>
In-Reply-To
<1439199967-9655-2-git-send-email-szeder@ira.uka.de>
On Mon, Aug 10, 2015 at 11:46:06AM +0200, SZEDER Gábor wrote:
Show 15 quoted lines
> 'git config' can only show values or name-value pairs, so if a shell
> script needs the names of set config variables it has to run 'git config
> --list' or '--get-regexp' and parse the output to separate config
> variable names from their values.  However, such a parsing can't cope
> with multi-line values.  Though 'git config' can produce null-terminated
> output for newline-safe parsing, that's of no use in such a case, becase
> shells can't cope with null characters.
> 
> Even our own bash completion script suffers from these issues.
> 
> Help the completion script, and shell scripts in general, by introducing
> the '--names-only' option to modify the output of '--list' and
> '--get-regexp' to list only the names of config variables, so they don't
> have to perform error-prone post processing to separate variable names
> from their values anymore.

Nice. The whole thing looks very neatly done. I have only one minor nit: the option "--names-only" is _almost_ the same as the "--name-only" diff option which is somewhat similar. Obviously they do different things and do not need to match, but I wonder if it would create less annoyance to just give them the same name.

-Peff
Previous: SZEDER GáborNext: Junio C Hamano
Message 3 of 18 in “[PATCHv3 0/2] 'git config --names-only' to help the completion script”
  1. SZEDER GáborAug 10, 2015
  2. 1/2 config: add '--names-only' option to list only variable namesSZEDER Gábor, Aug 10, 2015
  3. Jeff KingAug 10, 2015
  4. Junio C HamanoAug 10, 2015
  5. SZEDER GáborAug 12, 2015
  6. Junio C HamanoAug 13, 2015
  7. config: restructure format_config() for better control flowSZEDER Gábor, Aug 20, 2015
  8. Jeff KingAug 20, 2015
  9. 1/3 format_config: don't init strbufJeff King, Aug 20, 2015
  10. 2/3 format_config: simplify buffer handlingJeff King, Aug 20, 2015
  11. SZEDER GáborAug 21, 2015
  12. Junio C HamanoAug 21, 2015
  13. Junio C HamanoAug 21, 2015
  14. Jeff KingAug 21, 2015
  15. 3/3 get_urlmatch: avoid useless strbuf writeJeff King, Aug 20, 2015
  16. Junio C HamanoAug 20, 2015
  17. 2/2 completion: list variable names reliably with 'git config --names-only'SZEDER Gábor, Aug 10, 2015
  18. Jeff KingAug 10, 2015

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.