git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jade Lovelace <lists@jade.fyi>
To: git@vger.kernel.org
Subject: BUG: git config --global --get ITEM ignores ~/.config/git/config when ~/.gitconfig is present
Date: Fri, 10 Feb 2023 16:39:17 -0800	[thread overview]
Message-ID: <CAFA9we-QLQRzJdGMMCPatmfrk1oHeiUu9msMRXXk1MLE5HRxBQ@mail.gmail.com> (raw)

Dear maintainers,

I have found what I think is a bug or at least a documentation flaw in
git-config: when both ~/.gitconfig and ~/.config/git/config exist,
`git config` can retrieve items set in the latter, but not with the
`--global` flag set. For context, I use ~/.gitconfig as a
non-checked-in machine-specific config, and ~/.config/git/config as my
checked-in all-machines configuration file.

The documentation states:
> When reading, the values are read from the system, global and repository local configuration files by default, and options --system, --global, --local, --worktree and --file can be used to tell the command to read from only that location (see the section called “FILES”).

> FILES
>        $XDG_CONFIG_HOME/git/config, ~/.gitconfig
>           User-specific configuration files. When the XDG_CONFIG_HOME environment variable is not set or empty, $HOME/.config/ is used as $XDG_CONFIG_HOME.
>
>           These are also called "global" configuration files. If both files exist, both files are read in the order given above.

Based on this documentation, I would expect `--global` to consider
both global configuration files, but it does not.

Reproduction:

Set some setting in ~/.config/git/config, say:
[pull]
ff = only

Ensure that ~/.gitconfig exists.

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

» git --version
git version 2.39.1

Regards,
Jade

             reply	other threads:[~2023-02-11  0:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-11  0:39 Jade Lovelace [this message]
2023-02-11  1:33 ` BUG: git config --global --get ITEM ignores ~/.config/git/config when ~/.gitconfig is present Junio C Hamano
2023-02-11  1:44   ` Jade Lovelace
2023-02-11  1:56   ` Junio C Hamano
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=CAFA9we-QLQRzJdGMMCPatmfrk1oHeiUu9msMRXXk1MLE5HRxBQ@mail.gmail.com \
    --to=lists@jade.fyi \
    --cc=git@vger.kernel.org \
    /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).