Re: [PATCH] Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- May 31, 2012, 07:26 UTC
- Message-ID
- <vpqlik8q08x.fsf@bauges.imag.fr>
- In-Reply-To
- <1338400955-22991-1-git-send-email-Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
Huynh Khoi Nguyen NGUYEN <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr> writes:
> +$XDG_CONFIG_HOME/git/config:: > + Second user-specific configuration file. ~/.gitconfig has priority.
You should mention the behavior if $XDG_CONFIG_HOME is not set.
Show 6 quoted lines
> + if (home) {
> + const char *xdg_config_home = getenv("XDG_CONFIG_HOME");
> + if (xdg_config_home)
> + xdg_global = xstrdup(mkpath("%s/git/config", xdg_config_home));
> + else
> + xdg_global = xstrdup(mkpath("%s/.config/git/config", home));Shouldn't there be a helper function to get the path ~/.config/git/ and then append config? You're already computing this path twice, and we'll need more instances of it if we want to give default values to core.excludesfile and core.attributesfile in this directory too.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/