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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: <hidden>
Date: 2016-06-15 22:53:56

Huynh Khoi Nguyen NGUYEN [off-list ref] 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  
quoted
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

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

From: Victor Engmark <hidden>
Date: 2016-06-15 22:53:56

On Wed, May 30, 2012 at 1:50 AM,  [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help