Allow ETC_GITCONFIG to be a relative path.

If ETC_GITCONFIG is not an absolute path, interpret it relative to
--exec-dir. This makes the installed binaries relocatable because the
prefix is not compiled-in.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
This commit is contained in:
Johannes Sixt
2007-06-10 20:14:53 +02:00
parent 77398b214d
commit 44bacc53bf

View File

@@ -395,7 +395,17 @@ int git_config_from_file(config_fn_t fn, const char *filename)
const char *git_etc_gitconfig(void)
{
return ETC_GITCONFIG;
static const char *system_wide;
if (!system_wide) {
system_wide = ETC_GITCONFIG;
/* interpret path relative to exec-dir */
if (system_wide[0] != '/' && system_wide[1] != ':') {
const char *exec_path = git_exec_path();
system_wide = prefix_path(exec_path, strlen(exec_path),
system_wide);
}
}
return system_wide;
}
int git_config(config_fn_t fn)