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

Re: [RFD] gitweb configuration

From
Petr Baudis <pasky@suse.cz>
Date
Jun 17, 2006, 23:23 UTC
Message-ID
<20060617232358.GK2609@pasky.or.cz>
In-Reply-To
<e720r0$qdv$1@sea.gmane.org>

Dear diary, on Sun, Jun 18, 2006 at 12:48:12AM CEST, I got a letter where Jakub Narebski <jnareb@gmail.com> said that...

Show 6 quoted lines
> Petr Baudis <pasky@suse.cz> writes:
> >  - we might want to have a configuration mechanism in place
> >    before enhancing gitweb.  My gut feeling is that we can use
> >    [gitweb] section in project.git/config (and probably
> >    duplicate first and deprecate later existing "description" as
> >    well).
(Note that this is what Junio said, not me.)
Show 6 quoted lines
> - gitweb installation options (gitweb version need not to correspond to 
>   git version, and we could theoretically have more than one gitweb
>   installation while one git-core installation). It was proposed to put
>   such options on gitweb.conf file in the same directory as gitweb.cgi.
>   Unfortunately if one would want to use git-repo-config for managing
>   gitweb.conf one is out of luck: git-repo-config uses $GIT_DIR/config.

In the longer term, perhaps this kind of configuration might land in the global git configuration file.

--- [PATCH] Support for extracting configuration from different files

Add $GIT_CONFIG environment variable whose content is used instead of .git/config if set. Also add $GIT_CONFIG_LOCAL as a forward-compatibility cue for whenever we will finally come to support] global configuration files (properly).

Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 Documentation/git-repo-config.txt |   12 ++++++++++++
 config.c                          |   12 +++++++++++-
 2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-repo-config.txt b/Documentation/git-repo-config.txt
index d5142e0..803c0d5 100644
--- a/Documentation/git-repo-config.txt
+++ b/Documentation/git-repo-config.txt
@@ -73,6 +73,18 @@ OPTIONS
 	List all variables set in .git/config.
 
 
+ENVIRONMENT
+-----------
+
+GIT_CONFIG::
+	Take the configuration from the given file instead of .git/config.
+
+GIT_CONFIG_LOCAL::
+	Currently the same as $GIT_CONFIG; when Git will support global
+	configuration files, this will cause it to take the configuration
+	from the global configuration file in addition to the given file.
+
+
 EXAMPLE
 -------
 
diff --git a/config.c b/config.c
index c474970..42e1493 100644
--- a/config.c
+++ b/config.c
@@ -317,7 +317,17 @@ 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"));
+	const char *filename = git_path("config");
+	/* Forward-compatibility cue: $GIT_CONFIG makes git read _only_
+	 * the given config file, $GIT_CONFIG_LOCAL will make it process
+	 * it in addition to the global config file, the same way it would
+	 * the per-repository config file otherwise. */
+	if (getenv("GIT_CONFIG")) {
+		filename = getenv("GIT_CONFIG");
+	} else if (getenv("GIT_CONFIG_LOCAL")) {
+		filename = getenv("GIT_CONFIG_LOCAL");
+	}
+	return git_config_from_file(fn, filename);
 }
 
 /*
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
A person is just about as big as the things that make them angry.
Previous: Jakub NarebskiNext: Jakub Narebski
Message 2 of 12 in “[RFD] gitweb configuration”
  1. Jakub NarebskiJun 17, 2006
  2. Petr BaudisJun 17, 2006
  3. Jakub NarebskiJun 18, 2006
  4. Martin LanghoffJun 18, 2006
  5. Jakub NarebskiJun 18, 2006
  6. Timo HirvonenJun 18, 2006
  7. Jakub NarebskiJun 18, 2006
  8. Junio C HamanoJun 18, 2006
  9. Jakub NarebskiJun 18, 2006
  10. Martin LanghoffJun 18, 2006
  11. Junio C HamanoJun 18, 2006
  12. Petr BaudisJun 18, 2006

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.