diff options
author | Johannes Sixt <johannes.sixt@telecom.at> | 2007-11-13 21:05:05 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-14 15:18:39 -0800 |
commit | 506b17b136ba8ee29098c2ee26b94f527cea9ebc (patch) | |
tree | f620d1e57f1be34d5c98ab162801c147699b2f26 /config.c | |
parent | Allow a relative builtin template directory. (diff) | |
download | tgif-506b17b136ba8ee29098c2ee26b94f527cea9ebc.tar.xz |
Introduce git_etc_gitconfig() that encapsulates access of ETC_GITCONFIG.
In a subsequent patch the path to the system-wide config file will be
computed. This is a preparation for that change. It turns all accesses
of ETC_GITCONFIG into function calls. There is no change in behavior.
As a consequence, config.c is the only file that needs the definition of
ETC_GITCONFIG. Hence, -DETC_GITCONFIG is removed from the CFLAGS and a
special build rule for config.c is introduced. As a side-effect, changing
the defintion of ETC_GITCONFIG (e.g. in config.mak) does not trigger a
complete rebuild anymore.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -459,6 +459,11 @@ int git_config_from_file(config_fn_t fn, const char *filename) return ret; } +const char *git_etc_gitconfig(void) +{ + return ETC_GITCONFIG; +} + int git_config(config_fn_t fn) { int ret = 0; @@ -471,8 +476,8 @@ int git_config(config_fn_t fn) * config file otherwise. */ filename = getenv(CONFIG_ENVIRONMENT); if (!filename) { - if (!access(ETC_GITCONFIG, R_OK)) - ret += git_config_from_file(fn, ETC_GITCONFIG); + if (!access(git_etc_gitconfig(), R_OK)) + ret += git_config_from_file(fn, git_etc_gitconfig()); home = getenv("HOME"); filename = getenv(CONFIG_LOCAL_ENVIRONMENT); if (!filename) |