mirror of
https://github.com/git/git.git
synced 2026-02-03 22:42:53 +00:00
mingw: Try to delete target directory first.
When the rename function tries to move a directory it fails if the target directory exists. It should check if it can delete the (possibly empty) target directory and then try again to move the directory. Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: 마누엘 <nalla@users.noreply.github.com>
This commit is contained in:
@@ -1648,7 +1648,12 @@ repeat:
|
||||
if (gle == ERROR_ACCESS_DENIED &&
|
||||
(attrs = GetFileAttributesW(wpnew)) != INVALID_FILE_ATTRIBUTES) {
|
||||
if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
errno = EISDIR;
|
||||
DWORD attrsold = GetFileAttributesW(wpold);
|
||||
if (attrsold == INVALID_FILE_ATTRIBUTES ||
|
||||
!(attrsold & FILE_ATTRIBUTE_DIRECTORY))
|
||||
errno = EISDIR;
|
||||
else if (!_wrmdir(wpnew))
|
||||
goto repeat;
|
||||
return -1;
|
||||
}
|
||||
if ((attrs & FILE_ATTRIBUTE_READONLY) &&
|
||||
|
||||
Reference in New Issue
Block a user