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

Re: [PATCH] refs: parse_hide_refs_config to use parse_config_key

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 24, 2017, 21:24 UTC
Message-ID
<xmqqvarzz3hl.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170224212025.hcxusnrxijzb5qox@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 26 quoted lines
> On Fri, Feb 24, 2017 at 01:18:48PM -0800, Junio C Hamano wrote:
>
>> > While I'm thinking about it, here are patches to do that. The third one
>> > I'd probably squash into yours (after ordering it to the end).
>> >
>> >   [1/3]: parse_config_key: use skip_prefix instead of starts_with
>> >   [2/3]: parse_config_key: allow matching single-level config
>> >   [3/3]: parse_hide_refs_config: tell parse_config_key we don't want a subsection
>> 
>> While you were doing that, I was grepping the call sites for
>> parse_config_key() and made sure that all of them are OK when fed
>> two level names.  Most of them follow this pattern:
>> 
>> 	if (parse_config_key(k, "diff", &name, &namelen, &type) || !name)
>> 		return -1;
>> 
>> and ones that do not immediately check !name does either eventually
>> do so or have separate codepaths for handlihng two- and three-level
>> names.
>
> Yeah, I did that, too. :)
>
> I don't think there are any other sites to convert. And I don't think we
> can make the "!name" case easier (because some call-sites do want to
> handle both types). And it's not like it gets much easier anyway (unlike
> the opposite case, you _do_ need to declare the extra variables.

Yeah, because the rejection of !name as an error is not the only reason these call sites have &name and &namelen---they want to use that subsection name after that if() statement rejects malformed input, so we cannot really lose them.

Thanks.  All three looked good.
Previous: Jeff King
Message 16 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.