summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 437b1b2)
raw | patch | inline | side by side (parent: 437b1b2)
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | |
Wed, 14 Feb 2007 11:48:14 +0000 (12:48 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 20 Feb 2007 07:05:16 +0000 (23:05 -0800) |
The settings in /etc/gitconfig can be overridden in ~/.gitconfig,
which in turn can be overridden in .git/config.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
which in turn can be overridden in .git/config.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/config.txt | patch | blob | history | |
Makefile | patch | blob | history | |
builtin-config.c | patch | blob | history | |
config.c | patch | blob | history |
index 38655350f22bde08786b4a42e608ba76c1becea4..1dd90d804623e8d6c88caf11059801aadf6d26f3 100644 (file)
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
the git command's behavior. `.git/config` file for each repository
is used to store the information for that repository, and
`$HOME/.gitconfig` is used to store per user information to give
-fallback values for `.git/config` file.
+fallback values for `.git/config` file. The file `/etc/gitconfig`
+can be used to store system-wide defaults.
They can be used by both the git plumbing
and the porcelains. The variables are divided into sections, where
diff --git a/Makefile b/Makefile
index 40bdcff696f3270ced943945183306fc9899407d..203aac4517b3ac0311e0e6444caf64a5fa2b67df 100644 (file)
--- a/Makefile
+++ b/Makefile
bindir = $(prefix)/bin
gitexecdir = $(bindir)
template_dir = $(prefix)/share/git-core/templates/
+ETC_GITCONFIG = $(prefix)/etc/gitconfig
# DESTDIR=
# default configuration for gitweb
# Shell quote (do not use $(call) to accommodate ancient setups);
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
+ETC_GITCONFIG_SQ = $(subst ','\'',$(ETC_GITCONFIG))
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
bindir_SQ = $(subst ','\'',$(bindir))
LIBS = $(GITLIBS) $(EXTLIBS)
-BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' $(COMPAT_CFLAGS)
+BASIC_CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER_SQ)' \
+ -DETC_GITCONFIG='"$(ETC_GITCONFIG_SQ)"' $(COMPAT_CFLAGS)
LIB_OBJS += $(COMPAT_OBJS)
ALL_CFLAGS += $(BASIC_CFLAGS)
diff --git a/builtin-config.c b/builtin-config.c
index 0f9051da17c6e399709bd476ab867f4505ecba63..f1433a4ab6ffaa6fe29fe6be9d97f02a4c4d6e87 100644 (file)
--- a/builtin-config.c
+++ b/builtin-config.c
int ret = -1;
char *tl;
char *global = NULL, *repo_config = NULL;
- const char *local;
+ const char *system_wide = NULL, *local;
local = getenv(CONFIG_ENVIRONMENT);
if (!local) {
local = repo_config = xstrdup(git_path("config"));
if (home)
global = xstrdup(mkpath("%s/.gitconfig", home));
+ system_wide = ETC_GITCONFIG;
}
key = xstrdup(key_);
}
}
+ if (do_all && system_wide)
+ git_config_from_file(show_config, system_wide);
if (do_all && global)
git_config_from_file(show_config, global);
git_config_from_file(show_config, local);
if (!do_all && !seen && global)
git_config_from_file(show_config, global);
+ if (!do_all && !seen && system_wide)
+ git_config_from_file(show_config, system_wide);
free(key);
if (regexp) {
} else {
die("$HOME not set");
}
- } else if (!strcmp(argv[1], "--rename-section")) {
+ }
+ else if (!strcmp(argv[1], "--system"))
+ setenv("GIT_CONFIG", ETC_GITCONFIG, 1);
+ else if (!strcmp(argv[1], "--rename-section")) {
int ret;
if (argc != 4)
usage(git_config_set_usage);
return 1;
}
return 0;
- } else
+ }
+ else
break;
argc--;
argv++;
diff --git a/config.c b/config.c
index d82107124a53bca99ee65ea31dceb3871bf6796f..b0c0948cc825f783ee5187aa5ff60838bd4a2759 100644 (file)
--- a/config.c
+++ b/config.c
* config file otherwise. */
filename = getenv(CONFIG_ENVIRONMENT);
if (!filename) {
+ if (!access(ETC_GITCONFIG, R_OK))
+ ret += git_config_from_file(fn, ETC_GITCONFIG);
home = getenv("HOME");
filename = getenv(CONFIG_LOCAL_ENVIRONMENT);
if (!filename)