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

Re: [PATCH] git-remote: load config whenever create_symref() might be called

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 26, 2020, 21:52 UTC
Message-ID
<xmqqeejcqlpq.fsf@gitster.c.googlers.com>
In-Reply-To
<20201226134420.722643-1-Jeremie.Detrey@altu.fr>
Jérémie Detrey <Jeremie.Detrey@altu.fr> writes:
Show 8 quoted lines
> Currently, the calls to `create_symref()` do not honor the
> `core.logAllRefUpdates` nor the `user.{name,email}` configuration
> settings, and therefore write reflogs even when explicitly asked not
> to, and ignore the configured user identity.
>
> This happens on `git remote add --fetch`, `git remote set-head`, and
> `git remote rename`: these are the three commands which may create
> a symbolic-ref for the remote's HEAD.
Good problem description.

The usual way we structure the program start-up is do things in the following order:

 - have the hard-coded built-in default in the form of file-scope
   static variable definition with initial values; remote.c::value
   is an example that by default we are not verbose unless anybody
   else (below) says otherwise.
 - call git_config() to read and set configured defaults, which
   would override the hard-coded built-in default values.
 - call parse_options(), or other use some other means, to parse the
   command line options to further override the values that may have
   been set by reading the configuration files.

My gut feeling says that the best place to call git_config() on git_default_config would actually be in cmd_remote(), immediately before we call parse_options() to parse the main options shared by all subcommands of "git remote". Is there a reason why codepaths other than the three you singled out should *not* be affected by the basic set of configuration variables?

Thanks.
Previous: Jérémie DetreyNext: Jérémie Detrey
Message 2 of 5 in “git-remote: load config whenever create_symref() might be called”
  1. git-remote: load config whenever create_symref() might be calledJérémie Detrey, Dec 26, 2020
  2. Junio C HamanoDec 26, 2020
  3. Jérémie DetreyDec 26, 2020
  4. Eric SunshineDec 27, 2020
  5. Junio C HamanoDec 27, 2020

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.