From: Yaroslav Halchenko <yoh@onerussian.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: kyle@kyleam.com
Subject: Q: rational for $XDG_CONFIG_HOME/git/config to be "non global" or just a bug?
Date: Mon, 11 Dec 2017 16:11:02 -0500 [thread overview]
Message-ID: <20171211211102.rrxqd6yscnd33efd@hopa.kiewit.dartmouth.edu> (raw)
Dear Git Gurus,
We [1] have got confused a bit about this recent addition of handling
$XDG_CONFIG_HOME/git/config -- is it --global or not? ;)
According to the man git-config (v 2.15.0 in debian)
--global
For writing options: write to global ~/.gitconfig file rather than
the repository .git/config, write to $XDG_CONFIG_HOME/git/config
file if this file exists and the ~/.gitconfig file doesn’t.
For reading options: read only from global ~/.gitconfig and from
$XDG_CONFIG_HOME/git/config rather than from all available files.
See also the section called “FILES”.
suggesting that $XDG_CONFIG_HOME/git/config is a part of the "--global" config
space, which it is not, which is also later described in FILES:
$(prefix)/etc/gitconfig
System-wide configuration file.
$XDG_CONFIG_HOME/git/config
Second user-specific configuration file. If $XDG_CONFIG_HOME is not set or empty, $HOME/.config/git/config will be used. Any
single-valued variable set in this file will be overwritten by whatever is in ~/.gitconfig. It is a good idea not to create this file if
you sometimes use older versions of Git, as support for this file was added fairly recently.
~/.gitconfig
User-specific configuration file. Also called "global" configuration file.
which
1. says that $XDG_CONFIG_HOME/git/config is the "Second user-specific ..."
suggesting that it should be the one read AFTER the first user-specific...
I guess that the first one is the ~/.gitconfig , but then why the first one
overrides the settings of the second one ? ;) (as described above in TFM and
see below for an example)
2. why $XDG_CONFIG_HOME/git/config is not a part of the "global" configuration?
I always assumed that "global" is ALL settings defined for a user,
which are not specific to a repository.
It is double-confusing since, as --global doc describes (and example
below shows), git config --global --add modifies the
$XDG_CONFIG_HOME/git/config if there is no ~/.gitconfig
Actually the doc for --global for "reading" seems to be not correct,
that the file is not consulted for --global (see below)
Example to show that TFM outlines precedence and --global correctly:
$> grep xdg .gitconfig .config/git/config
.gitconfig: xdg-and-user = user
.config/git/config: xdg = xdg
.config/git/config: xdg-and-user = xdg
$> git config user.xdg ; git config user.xdg-and-user
xdg
user
$> git config --global user.xdg # so outputs nothing
$> git config --global user.xdg-and-user
user
$> mv .gitconfig{,.aside}
$> git config --global --add user.new value
$> cat .config/git/config
[user]
xdg = xdg
xdg-and-user = xdg
new = value
So, is that simply a bug and $XDG_CONFIG_HOME/git/config should be
consulted for --global reading and doc should be adjusted to
state that it is a part of "global" config in FILES description?
Or it shouldn't be --global (then writing should be fixed, and
documentation adjusted to exclude it from --global)
Or am I just confused? ;)
thanks in advance for the clarification!
[1] https://github.com/datalad/datalad/pull/2019#issuecomment-350757960
--
Yaroslav O. Halchenko
Center for Open Neuroscience http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
next reply other threads:[~2017-12-11 21:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-11 21:11 Yaroslav Halchenko [this message]
2017-12-11 22:56 ` Q: rational for $XDG_CONFIG_HOME/git/config to be "non global" or just a bug? Jonathan Nieder
2017-12-12 0:48 ` Yaroslav Halchenko
2017-12-12 1:05 ` Junio C Hamano
2017-12-12 9:36 ` Jacob Keller
2017-12-12 19:36 ` Junio C Hamano
2017-12-13 5:35 ` Jacob Keller
2017-12-12 14:13 ` Yaroslav Halchenko
2017-12-13 5:35 ` Jacob Keller
2017-12-16 22:01 ` brian m. carlson
2017-12-18 4:03 ` Jacob Keller
2017-12-18 6:40 ` Jeff King
2017-12-18 14:21 ` Yaroslav Halchenko
2017-12-18 16:55 ` Junio C Hamano
2017-12-18 19:56 ` Jacob Keller
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171211211102.rrxqd6yscnd33efd@hopa.kiewit.dartmouth.edu \
--to=yoh@onerussian.com \
--cc=git@vger.kernel.org \
--cc=kyle@kyleam.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).