summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-08-19 23:14:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-08-19 23:14:53 (GMT)
commit5a0482662f076ca7e1f27ef2848feec1763583d1 (patch)
tree7c2941da2e5d18fa17ecbd05a099597fc3040731 /compat/mingw.c
parent6f8a2138b96c8f33ebbe2055a9444ada40a8e1c8 (diff)
parent680e0b4524482c4bb679030188f6ae8db4caff06 (diff)
downloadgit-5a0482662f076ca7e1f27ef2848feec1763583d1.zip
git-5a0482662f076ca7e1f27ef2848feec1763583d1.tar.gz
git-5a0482662f076ca7e1f27ef2848feec1763583d1.tar.bz2
Merge branch 'jh/mingw-unlink'
"unlink" emulation on MinGW has been optimized. * jh/mingw-unlink: mingw: improve performance of mingw_unlink()
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 4454b3e..a00f331 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -290,6 +290,9 @@ int mingw_unlink(const char *pathname)
if (xutftowcs_path(wpathname, pathname) < 0)
return -1;
+ if (DeleteFileW(wpathname))
+ return 0;
+
/* read-only files cannot be removed */
_wchmod(wpathname, 0666);
while ((ret = _wunlink(wpathname)) == -1 && tries < ARRAY_SIZE(delay)) {