mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
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:
12
config.c
12
config.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user