Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-06-22 13:46:48 +0300
committerJunio C Hamano <gitster@pobox.com>2021-06-29 06:11:51 +0300
commite355307692f49f2f02275b083e91532efed9f7c0 (patch)
treea4f19a2f1fe5b0758605bb0768b3592a827d6b39 /config.c
parent50101b93ca69babb389e6bdefd733ef014338d29 (diff)
config: normalize the path of the system gitconfig
Git for Windows is compiled with a runtime prefix, and that runtime prefix is typically `C:/Program Files/Git/mingw64`. As we want the system gitconfig to live in the sibling directory `etc`, we define the relative path as `../etc/gitconfig`. However, as reported by Philip Oakley, the output of `git config --show-origin --system -l` looks rather ugly, as it shows the path as `file:C:/Program Files/Git/mingw64/../etc/gitconfig`, i.e. with the `mingw64/../` part. By normalizing the path, we get a prettier path. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.c')
-rw-r--r--config.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/config.c b/config.c
index f9c400ad30..3cd10aeb90 100644
--- a/config.c
+++ b/config.c
@@ -1833,9 +1833,10 @@ static int git_config_from_blob_ref(config_fn_t fn,
char *git_system_config(void)
{
char *system_config = xstrdup_or_null(getenv("GIT_CONFIG_SYSTEM"));
- if (system_config)
- return system_config;
- return system_path(ETC_GITCONFIG);
+ if (!system_config)
+ system_config = system_path(ETC_GITCONFIG);
+ normalize_path_copy(system_config, system_config);
+ return system_config;
}
void git_global_config(char **user_out, char **xdg_out)