git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 14, 2007, 19:54 UTC
Message-ID
<Pine.LNX.4.63.0702142049430.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vfy98o78i.fsf@assigned-by-dhcp.cox.net>
Hi,
On Wed, 14 Feb 2007, Junio C Hamano wrote:
Show 21 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> 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)
Previous: Junio C HamanoNext: Johannes Schindelin
Message 17 of 30 in “/etc/gitconfig”
  1. Andy ParkinsFeb 14, 2007
  2. Peter BaumannFeb 14, 2007
  3. config: read system-wide defaults from /etc/gitconfigJohannes Schindelin, Feb 14, 2007
  4. Junio C HamanoFeb 14, 2007
  5. Johannes SchindelinFeb 14, 2007
  6. Junio C HamanoFeb 14, 2007
  7. Johannes SchindelinFeb 14, 2007
  8. Junio C HamanoFeb 14, 2007
  9. Nicolas PitreFeb 14, 2007
  10. Junio C HamanoFeb 14, 2007
  11. Andy ParkinsFeb 15, 2007
  12. Junio C HamanoFeb 15, 2007
  13. Han-Wen NienhuysFeb 14, 2007
  14. Junio C HamanoFeb 14, 2007
  15. Johannes SchindelinFeb 14, 2007
  16. Junio C HamanoFeb 14, 2007
  17. Johannes SchindelinFeb 14, 2007
  18. Johannes SchindelinFeb 14, 2007
  19. Junio C HamanoFeb 15, 2007
  20. Junio C HamanoFeb 15, 2007
  21. Eric WongFeb 15, 2007
  22. Eric WongFeb 15, 2007
  23. Junio C HamanoFeb 15, 2007
  24. Johannes SchindelinFeb 15, 2007
  25. Junio C HamanoFeb 15, 2007
  26. Johannes SchindelinFeb 15, 2007
  27. Jakub NarebskiFeb 19, 2007
  28. Uwe Kleine-KönigFeb 14, 2007
  29. Allow config files to be includedAlex Riesen, Feb 16, 2007
  30. Alex RiesenFeb 16, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.