Skip to content

Commit c42e98d

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
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 7331a53 commit c42e98d

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

16631663
const char *git_etc_gitconfig(void)
16641664
{
1665-
static const char *system_wide;
1666-
if (!system_wide)
1665+
static char *system_wide;
1666+
if (!system_wide) {
16671667
system_wide = system_path(ETC_GITCONFIG);
1668+
normalize_path_copy(system_wide, system_wide);
1669+
}
16681670
return system_wide;
16691671
}
16701672

0 commit comments

Comments
 (0)