Skip to content

Commit 1bcdaba

Browse files
Carson Howardethomson
authored andcommitted
fixed win32 p_unlink retry sleep issue
Fixed an issue where the retry logic on p_unlink sleeps before it tries setting a file to write mode causing unnecessary slowdown.
1 parent 8149f85 commit 1bcdaba

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/win32/posix_w32.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,11 @@ GIT_INLINE(int) unlink_once(const wchar_t *path)
243243
if (DeleteFileW(path))
244244
return 0;
245245

246+
set_errno();
247+
248+
if (errno == EACCES && ensure_writable(path) == 0 && DeleteFileW(path))
249+
return 0;
250+
246251
if (last_error_retryable())
247252
return GIT_RETRY;
248253

@@ -257,7 +262,7 @@ int p_unlink(const char *path)
257262
if (git_win32_path_from_utf8(wpath, path) < 0)
258263
return -1;
259264

260-
do_with_retries(unlink_once(wpath), ensure_writable(wpath));
265+
do_with_retries(unlink_once(wpath), 0);
261266
}
262267

263268
int p_fsync(int fd)

0 commit comments

Comments
 (0)