git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Yaroslav Halchenko <yoh@onerussian.com>
Cc: Jacob Keller <jacob.keller@gmail.com>,
	Git mailing list <git@vger.kernel.org>
Subject: Re: [PATCH] doc: clarify usage of XDG_CONFIG_HOME config file
Date: Wed, 13 Dec 2017 11:57:24 -0800	[thread overview]
Message-ID: <xmqqmv2mwgd7.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171213142334.oy2uvkamho4whspj@hopa.kiewit.dartmouth.edu> (Yaroslav Halchenko's message of "Wed, 13 Dec 2017 09:23:34 -0500")

Yaroslav Halchenko <yoh@onerussian.com> writes:

> It always read it for non--global
> ...
> and it doesn't read it for --global
> ...
> unless ~/.gitconfig is missing

Yes, this dates back to 21cf3227 ("config: read (but not write) from
$XDG_CONFIG_HOME/git/config file", 2012-06-22), around the time back
when we added support to use xdg locations and doing so without breaking
existing users.

Taken together with a later commit in the same series 0e8593dc
("config: write to $XDG_CONFIG_HOME/git/config file when
appropriate", 2012-06-22), which says:

    config: write to $XDG_CONFIG_HOME/git/config file when appropriate
    
    Teach git to write to $XDG_CONFIG_HOME/git/config if
    
     - it already exists,
     - $HOME/.gitconfig file doesn't, and
     - The --global option is used.
    
    Otherwise, write to $HOME/.gitconfig when the --global option is
    given, as before.
    
    If the user doesn't create $XDG_CONFIG_HOME/git/config, there is
    absolutely no change. Users can use this new file only if they want.
    
    If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/config
    will be used.
    
    Advice for users who often come back to an old version of Git: you
    shouldn't create this file.

the plan is to have either one of these and not both at the same
time.  A user who wants to live in xdg world (and wants to avoid
cluttering $HOME with .many-files) can do so by creating an empty
one there, and all writes from there on go to the xdg world; as
there will no $HOME/.gitconfig created, the read side attempting to
read from it does not matter.  Other users get $HOME/.gitconfig when
running "config --global" to write for the first time, or users who
have been using Git from olden days already have $HOME/.gitconfig,
and no write goes to xdg world, so again the read side attempting to
read from there does not matter, either.

Perhaps a doc update needs to clarify these.

Thanks.

      reply	other threads:[~2017-12-13 19:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 11:24 [PATCH] doc: clarify usage of XDG_CONFIG_HOME config file Jacob Keller
2017-12-12 15:20 ` Todd Zullinger
2017-12-13  5:36   ` Jacob Keller
2017-12-12 19:47 ` Junio C Hamano
2017-12-13  5:38   ` Jacob Keller
2017-12-13 14:23     ` Yaroslav Halchenko
2017-12-13 19:57       ` Junio C Hamano [this message]

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=xmqqmv2mwgd7.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.keller@gmail.com \
    --cc=yoh@onerussian.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.
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).