public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: "Jérémie Detrey" <Jeremie.Detrey@altu•fr>
Cc: git@vger•kernel.org, Shulhan <m.shulhan@gmail•com>,
	Brandon Williams <bwilliams.eng@gmail•com>,
	Johannes Schindelin <Johannes.Schindelin@gmx•de>
Subject: Re: [PATCH] git-remote: load config whenever create_symref() might be called
Date: Sat, 26 Dec 2020 13:52:17 -0800	[thread overview]
Message-ID: <xmqqeejcqlpq.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <20201226134420.722643-1-Jeremie.Detrey@altu.fr> ("Jérémie Detrey"'s message of "Sat, 26 Dec 2020 14:44:20 +0100")

Jérémie Detrey <Jeremie.Detrey@altu•fr> writes:

> 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.

  reply	other threads:[~2020-12-26 21:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26 13:44 [PATCH] git-remote: load config whenever create_symref() might be called Jérémie Detrey
2020-12-26 21:52 ` Junio C Hamano [this message]
2020-12-26 22:28   ` Jérémie Detrey
2020-12-27  0:34     ` Eric Sunshine
2020-12-27  6:22       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqeejcqlpq.fsf@gitster.c.googlers.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Jeremie.Detrey@altu$(echo .)fr \
    --cc=Johannes.Schindelin@gmx$(echo .)de \
    --cc=bwilliams.eng@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=m.shulhan@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox