# git/path.c - order of accessing ~/.gitconfig

3 messages from 2013-09-18 to 2013-09-18. Participants: Madhu, Matthieu Moy.
Thread: https://gitlist.dev/t/34959

## Madhu, 2013-09-18 14:40

Subject: git/path.c - order of accessing ~/.gitconfig
Message-ID: <20130918.201006.407922449.enometh@meer.net>
URL: https://gitlist.dev/e/20130918.201006.407922449.enometh%40meer.net

```

* commit 21cf32279120799a766d22416be7d82d9ecfbd04
|
| Author: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
| Date:   Fri Jun 22 11:03:23 2012 +0200
|
|    config: read (but not write) from $XDG_CONFIG_HOME/git/config file
|
|    Teach git to read the "gitconfig" information from a new location,
|    $XDG_CONFIG_HOME/git/config; this allows the user to avoid
|    cluttering $HOME with many per-application configuration files.
|
|    In the order of reading, this file comes between the global
|    configuration file (typically $HOME/.gitconfig) and the system wide
|    configuration file (typically /etc/gitconfig).


However git/config.c (git_config_early) commit accesses xdg_config
before user_config.  So the comments and documentation are
inconsistent with the code.

[This looks like an intentional bug, I spotted it when commenting out
 the accesses to files under ~/.config.  (protip: chmod 000 ~/.config helps
 identify and blacklist NWO "apps" and now git started complaining) ---Madhu

```

## Matthieu Moy, 2013-09-18 15:01

Subject: Re: git/path.c - order of accessing ~/.gitconfig
Message-ID: <vpq8uyuxjfe.fsf@anie.imag.fr>
URL: https://gitlist.dev/e/vpq8uyuxjfe.fsf%40anie.imag.fr
In-Reply-To: <20130918.201006.407922449.enometh@meer.net>

```
Madhu <enometh@meer.net> writes:

> * commit 21cf32279120799a766d22416be7d82d9ecfbd04
> |
> | Author: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
> | Date:   Fri Jun 22 11:03:23 2012 +0200
> |
> |    config: read (but not write) from $XDG_CONFIG_HOME/git/config file
> |
> |    Teach git to read the "gitconfig" information from a new location,
> |    $XDG_CONFIG_HOME/git/config; this allows the user to avoid
> |    cluttering $HOME with many per-application configuration files.
> |
> |    In the order of reading, this file comes between the global
> |    configuration file (typically $HOME/.gitconfig) and the system wide
> |    configuration file (typically /etc/gitconfig).
>
>
> However git/config.c (git_config_early) commit accesses xdg_config
> before user_config.  So the comments and documentation are
> inconsistent with the code.

It seems the commit message is wrong, indeed. But it's too late to fix
it. OTOH, the documentation seems right to me
(Documentation/git-config.txt). It says:

  $(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.
  
  $GIT_DIR/config::
  	Repository specific configuration file.


-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Madhu, 2013-09-18 17:56

Subject: Re: git/path.c - order of accessing ~/.gitconfig
Message-ID: <20130918.232645.170158661.enometh@meer.net>
URL: https://gitlist.dev/e/20130918.232645.170158661.enometh%40meer.net
In-Reply-To: <vpq8uyuxjfe.fsf@anie.imag.fr>

```
[I posted this via gmane (m3mwnac9ob.fsf@leonis4.robolove.meer.net)
 but the posting hasn't appeared, so I'm sending this by email..]

* Matthieu Moy <vpq8uyuxjfe.fsf@anie.imag.fr> :
Wrote on Wed, 18 Sep 2013 17:01:57 +0200:
|> * commit 21cf32279120799a766d22416be7d82d9ecfbd04
|> |    In the order of reading, this file comes between the global
|> |    configuration file (typically $HOME/.gitconfig) and the system wide
|> |    configuration file (typically /etc/gitconfig).
|>
|> However git/config.c (git_config_early) commit accesses xdg_config
|> before user_config.  So the comments and documentation are
|> inconsistent with the code.
|
| It seems the commit message is wrong, indeed. But it's too late to fix
| it. OTOH, the documentation seems right to me
| (Documentation/git-config.txt). It says:

No, The commit message is also right.  xdg_config indeed comes betweeen
git_etc_gitconfig and user_config, as the commit says, I misunderstood
what the commit was saying because it says this in the reverse order.
Sorry, (nothing to see here) ---Madhu

```
