提交 6a491a17 编写于 作者: C Clemens Buchacher 提交者: Junio C Hamano

http-push: remove remote locks on exit signals

If locks are not cleaned up the repository is inaccessible for 10 minutes.
Signed-off-by: NClemens Buchacher <drizzd@aon.at>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 a1292939
......@@ -1349,6 +1349,24 @@ static int unlock_remote(struct remote_lock *lock)
return rc;
}
static void remove_locks(void)
{
struct remote_lock *lock = remote->locks;
fprintf(stderr, "Removing remote locks...\n");
while (lock) {
unlock_remote(lock);
lock = lock->next;
}
}
static void remove_locks_on_signal(int signo)
{
remove_locks();
signal(signo, SIG_DFL);
raise(signo);
}
static void remote_ls(const char *path, int flags,
void (*userFunc)(struct remote_ls_ctx *ls),
void *userData);
......@@ -2256,6 +2274,10 @@ int main(int argc, char **argv)
goto cleanup;
}
signal(SIGINT, remove_locks_on_signal);
signal(SIGHUP, remove_locks_on_signal);
signal(SIGQUIT, remove_locks_on_signal);
/* Check whether the remote has server info files */
remote->can_update_info_refs = 0;
remote->has_info_refs = remote_exists("info/refs");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册