Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2020-12-01 01:49:45 +0300
committerJunio C Hamano <gitster@pobox.com>2020-12-01 01:49:45 +0300
commit3d8f81f21bdce9e0472ae8921fab31e650030ecd (patch)
tree26c94bfd52a7d675970fb85213f8692eda69fa61 /builtin
parentfa27e2d103704340d931c5c6670be39ef6a22368 (diff)
parentdf7f915fb6fb28ea5a1e3103251c251e53a80b1b (diff)
Merge branch 'sa/credential-store-timeout'
Multiple "credential-store" backends can race to lock the same file, causing everybody else but one to fail---reattempt locking with some timeout to reduce the rate of the failure. * sa/credential-store-timeout: crendential-store: use timeout when locking file
Diffstat (limited to 'builtin')
-rw-r--r--builtin/credential-store.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/builtin/credential-store.c b/builtin/credential-store.c
index 5331ab151a..ae3c1ba75f 100644
--- a/builtin/credential-store.c
+++ b/builtin/credential-store.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "config.h"
#include "lockfile.h"
#include "credential.h"
#include "string-list.h"
@@ -58,8 +59,11 @@ static void print_line(struct strbuf *buf)
static void rewrite_credential_file(const char *fn, struct credential *c,
struct strbuf *extra)
{
- if (hold_lock_file_for_update(&credential_lock, fn, 0) < 0)
- die_errno("unable to get credential storage lock");
+ int timeout_ms = 1000;
+
+ git_config_get_int("credentialstore.locktimeoutms", &timeout_ms);
+ if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)
+ die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
if (extra)
print_line(extra);
parse_credential_file(fn, c, NULL, print_line);