]> git.ipfire.org Git - thirdparty/git.git/commit
mingw: try to create symlinks without elevated permissions
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 9 Jan 2026 20:05:13 +0000 (20:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Jan 2026 02:32:55 +0000 (18:32 -0800)
commit6206f7aeb0c584c91d226e32d446d6d062fa9674
treeae634d24fa90de01c9228e6d977d989815ffedd0
parent97be7aa43a711646e66e1b11b43624e0940fe278
mingw: try to create symlinks without elevated permissions

As of Windows 10 Build 14972 in Developer Mode, a new flag is supported
by `CreateSymbolicLink()` to create symbolic links even when running
outside of an elevated session (which was previously required).

This new flag is called `SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE`
and has the numeric value 0x02.

Previous Windows 10 versions will not understand that flag and return
an `ERROR_INVALID_PARAMETER`, therefore we have to be careful to try
passing that flag only when the build number indicates that it is
supported.

For more information about the new flag, see this blog post:
https://blogs.windows.com/buildingapps/2016/12/02/symlinks-windows-10/

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw.c