mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-28 18:44:04 -05:00
mingw: when running in a Windows container, try to rename() harder
It is a known issue that a rename() can fail with an "Access denied" error at times, when copying followed by deleting the original file works. Let's just fall back to that behavior. Signed-off-by: JiSeop Moon <zcube@zcube.kr> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Johannes Schindelin
parent
8f4dae0ede
commit
b13757e045
@@ -2590,6 +2590,13 @@ repeat:
|
|||||||
return 0;
|
return 0;
|
||||||
gle = GetLastError();
|
gle = GetLastError();
|
||||||
|
|
||||||
|
if (gle == ERROR_ACCESS_DENIED && is_inside_windows_container()) {
|
||||||
|
/* Fall back to copy to destination & remove source */
|
||||||
|
if (CopyFileW(wpold, wpnew, FALSE) && !mingw_unlink(pold))
|
||||||
|
return 0;
|
||||||
|
gle = GetLastError();
|
||||||
|
}
|
||||||
|
|
||||||
/* revert file attributes on failure */
|
/* revert file attributes on failure */
|
||||||
if (attrs != INVALID_FILE_ATTRIBUTES)
|
if (attrs != INVALID_FILE_ATTRIBUTES)
|
||||||
SetFileAttributesW(wpnew, attrs);
|
SetFileAttributesW(wpnew, attrs);
|
||||||
|
|||||||
Reference in New Issue
Block a user