Re: [PATCH] config: read system-wide defaults from /etc/gitconfig

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

 



Hi,

On Wed, 14 Feb 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:
> 
> >> Stupid probably is too strong a word, but I think I'd agree we
> >> should default it to $(prefix)/etc and have distros override it
> >> in the Makefile.
> >
> > Fair enough. And my patch was not really complete. Please amend to spare 
> > me eternal shame:
> > --
> > [BROWN PAPERBAG PATCH ON TOP OF OTHER PATCH] 
> >
> > It is $prefix/etc/gitconfig now, and works also if you do not
> > `git config -l`. D'oh.
> 
> How would we run our tests without getting screwed by whatever
> non-standard values system-wide configuration may have?
> Currently we disable tester's ~/.gitconfig by exporting HOME
> from t/test-lib.sh, but that will not work for this.
> 
> I think we need to have a way to disable this setting, perhaps
> via an environment variable.

Yes. Just set GIT_CONFIG=/what/ever, and it no longer reads from 
~/.gitconfig or $prefix/etc/gitconfig.

But this possibly breaks down when creating a repository in a subdirectory 
of trash. Hmm.

> I do not think we need to support 'git config --system --set foo.bar 
> baz' but some people might have twisted minds ;-).

;-) Yes, I'd rather not have an administrator run git directly. But it 
_would_ be easy enough:

diff --git a/builtin-config.c b/builtin-config.c
index 0f9051d..a42d251 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -147,6 +152,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 			} else {
 				die("$HOME not set");
 			}
+		else if (!strcmp(argv[1], "--system-wide")) {
+			setenv("GIT_CONFIG", ETC_GITCONFIG, 1);
 		} else if (!strcmp(argv[1], "--rename-section")) {
 			int ret;
 			if (argc != 4)
-
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]