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

Re: [PATCH 2/3] parse_config_key: allow matching single-level config

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 24, 2017, 21:25 UTC
Message-ID
<xmqqr32nz3fn.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqzihbz3nz.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 15 quoted lines
> Jeff King <peff@peff.net> writes:
>
>> The parse_config_key() function was introduced to make it
>> easier to match "section.subsection.key" variables. It also
>> handles the simpler "section.key", and the caller is
>> responsible for distinguishing the two from its
>> out-parameters.
>>
>> Most callers who _only_ want "section.key" would just use a
>> strcmp(var, "section.key"), since there is no parsing
>> required. However, they may still use parse_config_key() if
>> their "section" variable isn't a constant (an example of
>> this is in parse_hide_refs_config).
>
> Perhaps "only" at the end of the title?

which still stands. My initial reaction was "eh, I didn't know it was an error to call the function for two-level names".

Show 5 quoted lines
> After grepping for call sites of this function, I think we can
> simplify quite a few instances of:
>
> 	if (parse_config_key(...) || !name)
> 		return ...;
This is false.  Sorry for the noise.
Previous: Junio C HamanoNext: Jeff King
Message 10 of 16 in “refs: parse_hide_refs_config to use parse_config_key”
  1. refs: parse_hide_refs_config to use parse_config_keyStefan Beller, Feb 24, 2017
  2. Jeff KingFeb 24, 2017
  3. refs: parse_hide_refs_config to use parse_config_keyStefan Beller, Feb 24, 2017
  4. Jeff KingFeb 24, 2017
  5. Junio C HamanoFeb 24, 2017
  6. Jeff KingFeb 24, 2017
  7. 1/3 parse_config_key: use skip_prefix instead of starts_withJeff King, Feb 24, 2017
  8. 2/3 parse_config_key: allow matching single-level configJeff King, Feb 24, 2017
  9. Junio C HamanoFeb 24, 2017
  10. Junio C HamanoFeb 24, 2017
  11. Jeff KingFeb 24, 2017
  12. 3/3 parse_hide_refs_config: tell parse_config_key we don't want a subsectionJeff King, Feb 24, 2017
  13. Stefan BellerFeb 24, 2017
  14. Junio C HamanoFeb 24, 2017
  15. Jeff KingFeb 24, 2017
  16. Junio C HamanoFeb 24, 2017

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.