]> Kevux Git Server - rit/commit
mingw: support renaming symlinks
authorKarsten Blees <karsten.blees@gmail.com>
Fri, 9 Jan 2026 20:05:08 +0000 (20:05 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Jan 2026 02:32:55 +0000 (18:32 -0800)
commit5e88e98c04267b44e4f822f297c60e1e8c852411
tree47ec6363a46c52557345b52ce33f946b5fb49566
parentac41bfa374d67023970b26dc7117c878dfb58d06
mingw: support renaming symlinks

Older MSVCRT's `_wrename()` function cannot rename symlinks over
existing files: it returns success without doing anything. Newer
MSVCR*.dll versions probably do not share this problem: according to CRT
sources, they just call `MoveFileEx()` with the `MOVEFILE_COPY_ALLOWED`
flag.

Avoid the `_wrename()` call, and go with directly calling
`MoveFileEx()`, with proper error handling of course.

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