git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jade Lovelace <lists@jade.fyi>
Cc: git@vger.kernel.org
Subject: Re: BUG: git config --global --get ITEM ignores ~/.config/git/config when ~/.gitconfig is present
Date: Fri, 10 Feb 2023 17:56:20 -0800	[thread overview]
Message-ID: <xmqqmt5lezi3.fsf@gitster.g> (raw)
In-Reply-To: <xmqqsffdf0ji.fsf@gitster.g> (Junio C. Hamano's message of "Fri, 10 Feb 2023 17:33:53 -0800")

Junio C Hamano <gitster@pobox.com> writes:

> Jade Lovelace <lists@jade.fyi> writes:
>
>> Then:
>>
>>  » git config --global --get user.name
>>  » git config --show-scope --show-origin --get user.name
>> global  file:/home/jade/.config/git/config      Jade Lovelace
>
> With "--get" replaced with "--get-all", what do you see?

Ah, nevermind.  With "--global", we seem to read from only one,
giving the ~/.gitconfig precedence over $XDG/git/config, even though
without "--global", we will read from both.

The code has been behaving like so since its inception at 21cf3227
(config: read (but not write) from $XDG_CONFIG_HOME/git/config file,
2012-06-22).  I am not sure if this was designed to behave like so
for a reason (which unfortunately is not clear in the log message of
the commit), or a bug that was caused by the authors who were too
focused on the writing side of the equation (which must pick just
one file to write to).

My gut feeling is that this is merely a bug that we can fix without
worrying too much about users screaming at us complaining that they
relied on the current behaviour.  Without --global we do read from
both, so with with "--global" the behaviour is inconsistent.

Thanks for a report.

  parent reply	other threads:[~2023-02-11  1:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-11  0:39 BUG: git config --global --get ITEM ignores ~/.config/git/config when ~/.gitconfig is present Jade Lovelace
2023-02-11  1:33 ` Junio C Hamano
2023-02-11  1:44   ` Jade Lovelace
2023-02-11  1:56   ` Junio C Hamano [this message]
2023-02-11  3:10     ` Junio C Hamano
2023-02-15  6:53       ` Glen Choo
2023-02-15 16:19         ` 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=xmqqmt5lezi3.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=lists@jade.fyi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).