git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Yaroslav Halchenko <yoh@onerussian.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	kyle@kyleam.com, Jeff King <peff@peff.net>
Subject: Re: Q: rational for $XDG_CONFIG_HOME/git/config to be "non global" or just a bug?
Date: Mon, 11 Dec 2017 19:48:31 -0500	[thread overview]
Message-ID: <20171212004831.2sfscbrlhyokzchz@hopa.kiewit.dartmouth.edu> (raw)
In-Reply-To: <20171211225615.GC214273@aiede.mtv.corp.google.com>


On Mon, 11 Dec 2017, Jonathan Nieder wrote:
> > 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

> I agree, this is confusing.

> Reverse engineering from source, I find that git reads the following
> files in sequence:

> 	system:
> 		/etc/gitconfig
> 	global:
> 		$XDG_CONFIG_HOME/git/config
> 		$HOME/.gitconfig
> 	repo:
> 		$GIT_DIR/config
> 	commandline:
> 		options passed with -c or GIT_CONFIG_PARAMETERS

> These terms (system, global, repo, etc) are accessible in code as
> current_config_scope().  I don't think there's any user-visible effect
> to $XDG_CONFIG_HOME/git/config and $HOME/.gitconfig both being global
> --- it would probably be a good cleanup to rename the scope for one of
> them.

Well, we have got at least one user/contributor now who uses
$XDG_CONFIG_HOME/git/config in favor of ~/.gitconfig since it makes it
easier for modular user configuration.

> I think the documentation

> 	~/.gitconfig
> 		User-specific configuration file. Also called "global"
> 		configuration file.

> should be clarified --- e.g. it could say

> 	$XDG_CONFIG_HOME/git/config
> 	~/.gitconfig
> 		User-specific configuration files. Because options in
> 		these files are not specific to any repository, thes
> 		are sometimes called global configuration files.

> As for "git config --global", I think the best thing would be to split
> it into two options: something like "git config --user" and "git
> config --xdg-user".  That way, it is unambiguous which configuration
> file the user intends to inspect or modify.  When a user calls "git
> config --global" and both files exist, it could warn that the command
> is ambiguous.

why ambiguous?  as long as both are consistently called global, and the
overloading rules are clear for reading -- nothing ambigous.  The only
ambigous logic would be for writing.

> Thoughts?

Well -- my main functionality concern that ATM
$XDG_CONFIG_HOME/git/config is (as of 2.15.0) only --global for writing
but not for regular reading (as I demonstrated in the original email)

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

  reply	other threads:[~2017-12-12  0:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-11 21:11 Q: rational for $XDG_CONFIG_HOME/git/config to be "non global" or just a bug? Yaroslav Halchenko
2017-12-11 22:56 ` Jonathan Nieder
2017-12-12  0:48   ` Yaroslav Halchenko [this message]
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=20171212004831.2sfscbrlhyokzchz@hopa.kiewit.dartmouth.edu \
    --to=yoh@onerussian.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=kyle@kyleam.com \
    --cc=peff@peff.net \
    /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).