summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64e86c5)
raw | patch | inline | side by side (parent: 64e86c5)
author | Petr Baudis <pasky@suse.cz> | |
Sat, 17 Jun 2006 23:23:58 +0000 (01:23 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 19 Jun 2006 04:19:07 +0000 (21:19 -0700) |
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-repo-config.txt | patch | blob | history | |
config.c | patch | blob | history |
index d5142e0dcd6799b8a94c9cd5a3f2bd17c3cb7289..803c0d5cae6db0a953380adc6ee3980a0afa72e0 100644 (file)
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 984c75f5dd06bd1d53eda206a2b57eea093dfd58..d46eb6d8293766c2c188a1f89891329e4db06d93 100644 (file)
--- a/config.c
+++ b/config.c
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);
}
/*