Skip to content

Commit 7645124

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 e4866a5 commit 7645124

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
@@ -1678,9 +1678,11 @@ static int git_config_from_blob_ref(config_fn_t fn,
16781678

16791679
const char *git_etc_gitconfig(void)
16801680
{
1681-
static const char *system_wide;
1682-
if (!system_wide)
1681+
static char *system_wide;
1682+
if (!system_wide) {
16831683
system_wide = system_path(ETC_GITCONFIG);
1684+
normalize_path_copy(system_wide, system_wide);
1685+
}
16841686
return system_wide;
16851687
}
16861688

0 commit comments

Comments
 (0)