Re: [PATCH] Introduce the GIT_HOME environment variable
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 19, 2009, 19:21 UTC
- Message-ID
- <7vhbrmahwq.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20091219153046.GG25474@genesis.frugalware.org>
Miklos Vajna <vmiklos@frugalware.org> writes:
Show 12 quoted lines
> 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?