Skip to content

Commit 3f30041

Browse files
kbleesdscho
authored andcommitted
Win32: change default of 'core.symlinks' to false
Symlinks on Windows don't work the same way as on Unix systems. E.g. there are different types of symlinks for directories and files, creating symlinks requires administrative privileges etc. By default, disable symlink support on Windows. I.e. users explicitly have to enable it with 'git config [--system|--global] core.symlinks true'. The test suite ignores system / global config files. Allow testing *with* symlink support by checking if native symlinks are enabled in MSys2 (via 'MSYS=winsymlinks:nativestrict'). Reminder: This would need to be changed if / when we find a way to run the test suite in a non-MSys-based shell (e.g. dash). Signed-off-by: Karsten Blees <[email protected]>
1 parent 86e8394 commit 3f30041

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compat/mingw.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,15 @@ static void setup_windows_environment()
22392239
if (!tmp && (tmp = getenv("USERPROFILE")))
22402240
setenv("HOME", tmp, 1);
22412241
}
2242+
2243+
/*
2244+
* Change 'core.symlinks' default to false, unless native symlinks are
2245+
* enabled in MSys2 (via 'MSYS=winsymlinks:nativestrict'). Thus we can
2246+
* run the test suite (which doesn't obey config files) with or without
2247+
* symlink support.
2248+
*/
2249+
if (!(tmp = getenv("MSYS")) || !strstr(tmp, "winsymlinks:nativestrict"))
2250+
has_symlinks = 0;
22422251
}
22432252

22442253
int handle_long_path(wchar_t *path, int len, int max_path, int expand)

0 commit comments

Comments
 (0)