From: Junio C Hamano Date: Sat, 19 Dec 2009 19:21:57 GMT Subject: Re: [PATCH] Introduce the GIT_HOME environment variable Message-ID: <7vhbrmahwq.fsf@alter.siamese.dyndns.org> In-Reply-To: <20091219153046.GG25474@genesis.frugalware.org> Miklos Vajna writes: > diff --git a/builtin-config.c b/builtin-config.c > index a2d656e..da9ebd4 100644 > --- a/builtin-config.c > +++ b/builtin-config.c > @@ -146,7 +146,9 @@ static int get_value(const char *key_, const char *regex_) > > local = config_exclusive_filename; > if (!local) { > - const char *home = getenv("HOME"); > + const char *home = getenv("GIT_HOME"); > + if (!home) > + home = getenv("HOME"); If you introduce a helper like this: const char *git_custom_home(void) { const char *val = getenv("GIT_HOME"); if (!val) val = getenv("HOME"); return val; } then a mechanical s/getenv("GIT_HOME")/gitcustom_home()/; will make the resulting code a lot simpler and a new callsite somebody may add in the future would not have to duplicate three lines. But I sense that Moe is retracting his claim that the unmodified git doesn't do what he needs to do, after Dscho suggested to use more specific environment variables to the task at hand?