You might see that error less often with Git 2.29 (Q4 2020): the "unlink" emulation on MinGW has been optimized.
See commit 680e0b4 (17 Aug 2020) by Jeff Hostetler (Jeff-Hostetler
).
(Merged by Junio C Hamano -- gitster
-- in commit 5a04826, 19 Aug 2020)
mingw
: improve performance ofmingw_unlink()
Signed-off-by: Jeff Hostetler
Signed-off-by: Johannes Schindelin
Update
mingw_unlink()
to first try to delete the file with existing permissions before trying to force it.Windows throws an error when trying to delete a read-only file.
Themingw_unlink()
compatibility wrapper always tries to_wchmod(
666) the file before calling_wunlink()
to avoid that error.
However, since most files in the worktree are already writable, this is usually wasted effort.Update
mingw_unlink()
to just callDeleteFileW()
directly and if that succeeds return.
If that fails, fall back into the existing code path to update the permissions and use_wunlink()
to get the existing error code mapping.