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
Jeff King <peff@peff.net>
Date
Feb 24, 2017, 21:26 UTC
Message-ID
<20170224212618.qwegffvga4p4n4o7@sigill.intra.peff.net>
In-Reply-To
<xmqqzihbz3nz.fsf@gitster.mtv.corp.google.com>
On Fri, Feb 24, 2017 at 01:20:48PM -0800, Junio C Hamano wrote:
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?
Yeah, that would be an improvement.
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 ...;

I think you figured this out from your other response, but no, those are the opposite case (it tricked me at first, too).

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 11 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.