Re: [PATCH] Introduce the GIT_HOME environment variable
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:47:55
Miklos Vajna [off-list ref] 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/