git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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/
Previous: Huynh Khoi Nguyen NGUYEN
Message 2 of 2 in “Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/config”
  1. Possibility to read both from ~/.gitconfig and from $XDG_CONFIG_HOME/git/configHuynh Khoi Nguyen NGUYEN, May 30, 2012
  2. Matthieu MoyMay 31, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.