]> git.ipfire.org Git - thirdparty/git.git/commit
mingw: handle symlinks to directories in `mingw_unlink()`
authorKarsten Blees <karsten.blees@gmail.com>
Fri, 9 Jan 2026 20:05:07 +0000 (20:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Jan 2026 02:32:55 +0000 (18:32 -0800)
commitac41bfa374d67023970b26dc7117c878dfb58d06
tree698d7a32b3125e8d1f39a3cc4d55f332d20cbf5d
parent9ac15c2ae3d4d7caf27444930f2e3d12a6eebee8
mingw: handle symlinks to directories in `mingw_unlink()`

The `_wunlink()` and `DeleteFileW()` functions refuse to delete symlinks
to directories on Windows; The error code would be `ERROR_ACCESS_DENIED`
in that case. Take that error code as an indicator that we need to try
`_wrmdir()` as well. In the best case, it will remove a symlink. In the
worst case, it will fail with the same error code again.

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