# [RFC] Possibility to have a per-user config directory

2 messages from 2012-05-29 to 2012-05-30. Participants: nguyenhu@minatec.inpg.fr, Victor Engmark.
Thread: https://gitlist.dev/t/30648

## nguyenhu@minatec.inpg.fr, 2012-05-29 23:50

Subject: [RFC] Possibility to have a per-user config directory
Message-ID: <20120530015035.Horde.XJPMC3wdC4BPxWDLkXMByVA@webmail.minatec.grenoble-inp.fr>
URL: https://gitlist.dev/e/20120530015035.Horde.XJPMC3wdC4BPxWDLkXMByVA%40webmail.minatec.grenoble-inp.fr

```

Huynh Khoi Nguyen NGUYEN <nguyenhu@minatec.inpg.fr> writes:
> Hello,
>
> As you know, git stores its configuration in ~/.gitconfig file and  
> in other >hidden files at the root of the user's directory.
>
> We would like to have a configuration directory instead of all these  
> >configuration files by following the XDG specification because:
> - not a lot of hidden files at the root, so better view
> - one directory per software in ~/.config

I update my suggestion.

As I said, I would like to propose to users the possibility to have an  
XDG configuration file, that's to say $XDG_CONFIG_HOME/git/config. If  
$XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/config  
will be used.

So now I will put forward 2 patches: one for reading, and one for writing.

Patch for reading:
Git would read both in $XDG_CONFIG_HOME/git/config and in ~/.gitconfig  
in this order:
.git/config > ~/.gitconfig > $XDG_CONFIG_HOME/git/config > /etc/gitconfig

Patch for writing:
Git would write its configuration in $XDG_CONFIG_HOME/git/config file if:
- this file exists,
- and ~/.gitconfig file doesn't.
Otherwise git would write its configuration in ~/.gitconfig as usual.

If you don't create $XDG_CONFIG_HOME/git/config, there is no change.
I don't want to force users to have $XDG_CONFIG_HOME/git/config.
I will write in documentation advice for users who often come back to  
an old version of Git, on different computers with the same $HOME, not  
to use $XDG_CONFIG_HOME/git/config for the time being. If they don't  
read documentation, they can't know possibility of  
$XDG_CONFIG_HOME/git/config.

I will send you the patch for reading before 24h.
Then I will try to send you the patch for writing before 24h.

We will also send other patches to propose to users the possiblity to  
have easily $XDG_CONFIG_HOME/git/gitignore and  
$XDG_CONFIG_HOME/git/gitattributes.

Valentin DUPERRAY,
Franck JONAS
Lucien KONG,
Thomas NGUY,
Huynh Khoi Nguyen NGUYEN,

Grenoble INP ENSIMAG

```

## Victor Engmark, 2012-05-30 11:49

Subject: Re: [RFC] Possibility to have a per-user config directory
Message-ID: <CAA5Ydx9u_nckv8MHXLhKR2JwCgptJq81vXpaHsA1Hqvb4Enuqg@mail.gmail.com>
URL: https://gitlist.dev/e/CAA5Ydx9u_nckv8MHXLhKR2JwCgptJq81vXpaHsA1Hqvb4Enuqg%40mail.gmail.com
In-Reply-To: <20120530015035.Horde.XJPMC3wdC4BPxWDLkXMByVA@webmail.minatec.grenoble-inp.fr>

```
On Wed, May 30, 2012 at 1:50 AM,  <nguyenhu@minatec.inpg.fr> wrote:
> Patch for writing:
> Git would write its configuration in $XDG_CONFIG_HOME/git/config file if:
> - this file exists,
> - and ~/.gitconfig file doesn't.
> Otherwise git would write its configuration in ~/.gitconfig as usual.

Minor suggestion: Write to $XDG_CONFIG_HOME/git/config if:
- $XDG_CONFIG_HOME/git exists (and therefore is planned for use even
if there is no config file within)
- [etc. as before]

Cheers,
Victor

```
