Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
rename_tmp_log(): on SCLD_VANISHED, retry
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sat, 18 Jan 2014 22:49:01 +0000
(23:49 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 21 Jan 2014 21:47:28 +0000
(13:47 -0800)
If safe_create_leading_directories() fails because a file along the
path unexpectedly vanished, try again from the beginning. Try at most
4 times.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
f1e9e9a
)
diff --git
a/refs.c
b/refs.c
index fd644f0f416fac0374b0e0f9dbc5d158ad6b7240..703b5a2f457e0b931cada8fc39c235ada8e48c0b 100644
(file)
--- a/
refs.c
+++ b/
refs.c
@@
-2533,7
+2533,14
@@
static int rename_tmp_log(const char *newrefname)
int attempts_remaining = 4;
retry:
- if (safe_create_leading_directories(git_path("logs/%s", newrefname))) {
+ switch (safe_create_leading_directories(git_path("logs/%s", newrefname))) {
+ case SCLD_OK:
+ break; /* success */
+ case SCLD_VANISHED:
+ if (--attempts_remaining > 0)
+ goto retry;
+ /* fall through */
+ default:
error("unable to create directory for %s", newrefname);
return -1;
}