From: Johannes Schindelin Date: Wed, 27 Jan 2016 16:19:29 GMT Subject: [PATCH v3 06/20] mingw: try to delete target directory before renaming Message-ID: <2185537d1ded7926241414b32e553d7ce4cd2935.1453911367.git.johannes.schindelin@gmx.de> In-Reply-To: From: =?UTF-8?q?=EB=A7=88=EB=88=84=EC=97=98?= 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. This partially fixes t9100-git-svn-basic.sh. Signed-off-by: 마누엘 Signed-off-by: Johannes Schindelin --- compat/mingw.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/compat/mingw.c b/compat/mingw.c index ba5cb1c..f37f8d5 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1603,7 +1603,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) && -- 2.7.0.windows.1.7.g55a05c8