Skip to content

Commit 9cdb13e

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 a0457cd commit 9cdb13e

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
@@ -3249,6 +3249,15 @@ static void setup_windows_environment(void)
32493249

32503250
if (!getenv("LC_ALL") && !getenv("LC_CTYPE") && !getenv("LANG"))
32513251
setenv("LC_CTYPE", "C.UTF-8", 1);
3252+
3253+
/*
3254+
* Change 'core.symlinks' default to false, unless native symlinks are
3255+
* enabled in MSys2 (via 'MSYS=winsymlinks:nativestrict'). Thus we can
3256+
* run the test suite (which doesn't obey config files) with or without
3257+
* symlink support.
3258+
*/
3259+
if (!(tmp = getenv("MSYS")) || !strstr(tmp, "winsymlinks:nativestrict"))
3260+
has_symlinks = 0;
32523261
}
32533262

32543263
static void get_current_user_sid(PSID *sid, HANDLE *linked_token)

0 commit comments

Comments
 (0)