Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
f34408a7
Commit
f34408a7
authored
Apr 04, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2211 from Yogu/retry-renaming-config
Retry committing locked files on error
parents
4c219cf6
2873a862
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletions
+22
-1
src/win32/posix_w32.c
+22
-1
No files found.
src/win32/posix_w32.c
View file @
f34408a7
...
...
@@ -467,10 +467,31 @@ int p_rename(const char *from, const char *to)
{
git_win32_path
wfrom
;
git_win32_path
wto
;
int
rename_tries
;
int
rename_succeeded
;
int
error
;
git_win32_path_from_c
(
wfrom
,
from
);
git_win32_path_from_c
(
wto
,
to
);
return
MoveFileExW
(
wfrom
,
wto
,
MOVEFILE_REPLACE_EXISTING
|
MOVEFILE_COPY_ALLOWED
)
?
0
:
-
1
;
/* wait up to 50ms if file is locked by another thread or process */
rename_tries
=
0
;
rename_succeeded
=
0
;
while
(
rename_tries
<
10
)
{
if
(
MoveFileExW
(
wfrom
,
wto
,
MOVEFILE_REPLACE_EXISTING
|
MOVEFILE_COPY_ALLOWED
)
!=
0
)
{
rename_succeeded
=
1
;
break
;
}
error
=
GetLastError
();
if
(
error
==
ERROR_SHARING_VIOLATION
||
error
==
ERROR_ACCESS_DENIED
)
{
Sleep
(
5
);
rename_tries
++
;
}
else
break
;
}
return
rename_succeeded
?
0
:
-
1
;
}
int
p_recv
(
GIT_SOCKET
socket
,
void
*
buffer
,
size_t
length
,
int
flags
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment