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

Re: [PATCH 1/4] config: factor out config file stack management

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Feb 26, 2013, 20:09 UTC
Message-ID
<20130226200940.GF22756@sandbox-ub>
In-Reply-To
<20130226195449.GA13830@sigill.intra.peff.net>
On Tue, Feb 26, 2013 at 02:54:49PM -0500, Jeff King wrote:
Show 28 quoted lines
> On Tue, Feb 26, 2013 at 08:38:50PM +0100, Heiko Voigt wrote:
> > +static int do_config_from(struct config_file *top, config_fn_t fn, void *data)
> > +{
> > +	int ret;
> > +
> > +	/* push config-file parsing state stack */
> > +	top->prev = cf;
> > +	top->linenr = 1;
> > +	top->eof = 0;
> > +	strbuf_init(&top->value, 1024);
> > +	strbuf_init(&top->var, 1024);
> > +	cf = top;
> > +
> > +	ret = git_parse_file(fn, data);
> > +
> > +	/* pop config-file parsing state stack */
> > +	strbuf_release(&top->value);
> > +	strbuf_release(&top->var);
> > +	cf = top->prev;
> > +
> > +	return ret;
> > +}
> 
> This function name is a bit weird. I would have thought the "from" here
> was going to be a file, or a string, or whatever. But the filename setup
> happens outside this function (and yet this function depends on it being
> set up, as it calls git_parse_file). But maybe it will get less
> confusing with the other patches on top...

The "do_config_from" means "parse from whatever is in 'top'". Later in the series its type changes from config_file to struct config.

The name 'git_parse_file' becomes definitely wrong after this series. Maybe I should rename it?

Cheers Heiko
Previous: Jeff KingNext: Jeff King
Message 8 of 25 in “fetch moved submodules on-demand”
  1. 0/3 fetch moved submodules on-demandHeiko Voigt, Feb 25, 2013
  2. 1/3 teach config parsing to read from strbufHeiko Voigt, Feb 25, 2013
  3. Junio C HamanoFeb 25, 2013
  4. Heiko VoigtFeb 25, 2013
  5. 0/4 allow more sources for config valuesHeiko Voigt, Feb 26, 2013
  6. 1/4 config: factor out config file stack managementHeiko Voigt, Feb 26, 2013
  7. Jeff KingFeb 26, 2013
  8. Heiko VoigtFeb 26, 2013
  9. Jeff KingFeb 26, 2013
  10. Junio C HamanoFeb 26, 2013
  11. Heiko VoigtFeb 27, 2013
  12. Junio C HamanoFeb 26, 2013
  13. Heiko VoigtFeb 27, 2013
  14. 2/4 config: drop file pointer validity check in get_next_char()Heiko Voigt, Feb 26, 2013
  15. Jeff KingFeb 26, 2013
  16. Heiko VoigtFeb 27, 2013
  17. Heiko VoigtFeb 28, 2013
  18. Heiko VoigtFeb 28, 2013
  19. 3/4 config: make parsing stack struct independent from actual data sourceHeiko Voigt, Feb 26, 2013
  20. 4/4 teach config parsing to read from strbufHeiko Voigt, Feb 26, 2013
  21. Ramsay JonesMar 7, 2013
  22. Heiko VoigtMar 10, 2013
  23. Jeff KingFeb 26, 2013
  24. 2/3 implement fetching of moved submodulesHeiko Voigt, Feb 25, 2013
  25. 3/3 submodule: simplify decision tree whether to or not to fetchHeiko Voigt, Feb 25, 2013

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.