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:

> 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?


--
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]