git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: git config --global --get ITEM ignores ~/.config/git/config when ~/.gitconfig is present
@ 2023-02-11  0:39 Jade Lovelace
  2023-02-11  1:33 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Jade Lovelace @ 2023-02-11  0:39 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-15 16:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2023-02-11  3:10     ` Junio C Hamano
2023-02-15  6:53       ` Glen Choo
2023-02-15 16:19         ` Junio C Hamano

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