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

Re: [PATCH] config: don't BUG when both kvi and source are set

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 26, 2023, 23:05 UTC
Message-ID
<xmqqh6qt4yeh.fsf@gitster.g>
In-Reply-To
<kl6l7crpsuhs.fsf@chooglen-macbookpro.roam.corp.google.com>
Glen Choo <chooglen@google.com> writes:
Show 7 quoted lines
> Ah, I meant that this bug occurred because most users of config use
> git_config()/repo_config() (a wrapper around config sets), so it's very
> easy to accidentally read repo config, e.g. in the middle of parsing
> config (config file -> config set). I'd imagine it might also be quite
> easy to read repo config while reading repo config (config set -> config
> set), which would make current_config_* return the wrong thing, but at
> least it doesn't BUG().

I think BUG() is better than silently computing a wrong result, but it would probably be much rare than the problem at hand, and with the getting rid of global dependencies, it won't be an issue anymore, hopefull? So it is good.

> The "reverse" case (config set -> config file) is very _unlikely_
> because very few places need to know about config files, so it's
> unlikely that we'd have an explicit call to parse a config file,
> especially in the middle of reading repo config.
As long as existing codepaths do not do that, it would be OK ;-)
Thanks.
Previous: Glen Choo
Message 4 of 4 in “config: don't BUG when both kvi and source are set”
  1. config: don't BUG when both kvi and source are setGlen Choo via GitGitGadget, Jun 26, 2023
  2. Junio C HamanoJun 26, 2023
  3. Glen ChooJun 26, 2023
  4. Junio C HamanoJun 26, 2023

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.