summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-08-19 16:14:53 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-08-19 16:14:53 -0700
commit5a0482662f076ca7e1f27ef2848feec1763583d1 (patch)
tree7c2941da2e5d18fa17ecbd05a099597fc3040731 /compat
parentMerge branch 'ds/sha256-leftover-bits' (diff)
parentmingw: improve performance of mingw_unlink() (diff)
downloadtgif-5a0482662f076ca7e1f27ef2848feec1763583d1.tar.xz
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')
-rw-r--r--compat/mingw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 4454b3e67b..a00f331230 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)) {