Re: [PATCH] Introduce the GIT_HOME environment variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Miklos Vajna <vmiklos@xxxxxxxxxxxxxx> writes:

> Honor $GIT_HOME that is favoured over $HOME,

I'd personally prefer obeying $XDG_CONFIG_HOME, and read
$XDG_CONFIG_HOME/git/config (defaulting to $HOME/.config/git/config)
or something like this :

http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html

It solves the same problem ("set on environment variable, and change
my whole Git config"), but

* It's a standard. It's really nice to be able to

cd ~/.config
ls

to see a user's configuration for many applications at a time, and

cd ~/.config
git init

to version-control it.

* It avoids hidden files. With $GIT_CONFIG, a user doing

cd $GIT_HOME
ls

sees nothing. I understand why $HOME/something config files are
hidden, but a config file stored in a separate directory shouldn't be
hidden (just like $GIT_DIR/config is not hidden).

> -		const char *home = getenv("HOME");
> +		const char *home = getenv("GIT_HOME");
> +		if (!home)
> +			home = getenv("HOME");

If you go this way, why not define

const char *getenv_home()
{
	const char *home = getenv("GIT_HOME");
	if (!home)
		home = getenv("HOME");
	return home;
}

?

(probably in git-compat-util.h)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]