Re: [PATCH] Read configuration also from ~/.gitrc

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

 



Hi,

On Mon, 29 May 2006, Petr Baudis wrote:

> diff --git a/config.c b/config.c
> index 0248c6d..8a98865 100644
> --- a/config.c
> +++ b/config.c
> @@ -312,7 +312,11 @@ int git_config_from_file(config_fn_t fn,
>  
>  int git_config(config_fn_t fn)
>  {
> -	return git_config_from_file(fn, git_path("config"));
> +	int ret = 0;
> +	if (getenv("HOME"))
> +		ret += git_config_from_file(fn, mkpath("%s/.gitrc", getenv("HOME")));
> +	ret += git_config_from_file(fn, git_path("config"));
> +	return ret;
>  }
>  
>  /*


But would this not break for the normal case? If you override one key in 
the repository's config, with this patch, repo-config will barf. The 
normal case is that you do not expect multiple values for the same key. 
Your patch reads both ~/.gitrc and $GIT_DIR/config, and if a key has a 
value in both (even if they are identical), repo-config will error out.

Further, storing a key will no longer work. This is an obscure side 
effect of this patch not caring about storing anything in ~/.gitrc: If you 
find the key section (or the key) in ~/.gitrc, the offset will be stored, 
_and used on $GIT_DIR/config_!

I agree it is nice to have a global git configuration, but I have it: I 
use templates.

Ciao,
Dscho

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