Skip to content

Commit a25845d

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 <[email protected]>
1 parent 1f3e37a commit a25845d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

config.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,9 +1657,11 @@ static int git_config_from_blob_ref(config_fn_t fn,
16571657

16581658
const char *git_etc_gitconfig(void)
16591659
{
1660-
static const char *system_wide;
1661-
if (!system_wide)
1660+
static char *system_wide;
1661+
if (!system_wide) {
16621662
system_wide = system_path(ETC_GITCONFIG);
1663+
normalize_path_copy(system_wide, system_wide);
1664+
}
16631665
return system_wide;
16641666
}
16651667

0 commit comments

Comments
 (0)