From 1f18247099c5fd8617a8e706877c1778fc5c0578 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 26 Mar 2025 09:01:33 +0100 Subject: [PATCH] mingw_rename: support ReFS on Windows 2022 ReFS is an alternative filesystem to NTFS. On Windows 2022, it seems not to support the rename operation using POSIX semantics that Git uses on Windows as of 391bceae4350 (compat/mingw: support POSIX semantics for atomic renames, 2024-10-27). However, Windows 2022 reports `ERROR_NOT_SUPPORTED` in this instance. This is in contrast to `ERROR_INVALID_PARAMETER` (as previous Windows versions would report that do not support POSIX semantics in renames at all). Let's handle both errors the same: by falling back to the best-effort option, namely to rename without POSIX semantics. This fixes https://github.com/git-for-windows/git/issues/5427 Signed-off-by: Johannes Schindelin --- compat/mingw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/mingw.c b/compat/mingw.c index d5cbfb0ff0..281148d301 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2277,7 +2277,7 @@ repeat: * current system doesn't support FileRenameInfoEx. Keep us * from using it in future calls and retry. */ - if (gle == ERROR_INVALID_PARAMETER) { + if (gle == ERROR_INVALID_PARAMETER || gle == ERROR_NOT_SUPPORTED) { supports_file_rename_info_ex = 0; goto repeat; }