diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-05-22 12:41:55 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-22 12:41:55 -0700 |
commit | fb257bfa174b00e236ac5d6f4282a487f10a9e98 (patch) | |
tree | 616da2c04e2140fe22bd4cfaf7f3b9b764d769c3 /refs.c | |
parent | 29b2041c2a91d2f80afa9d4e0f6eeb77a3ff5bc6 (diff) | |
parent | f4ab4f3ab117cf375ae7bb8908c7b5ad687342b1 (diff) | |
download | git-fb257bfa174b00e236ac5d6f4282a487f10a9e98.tar.gz |
Merge branch 'mh/lockfile-retry'
Instead of dying immediately upon failing to obtain a lock, retry
after a short while with backoff.
* mh/lockfile-retry:
lock_packed_refs(): allow retries when acquiring the packed-refs lock
lockfile: allow file locking to be retried with a timeout
Diffstat (limited to 'refs.c')
-rw-r--r-- | refs.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -2505,9 +2505,19 @@ static int write_packed_entry_fn(struct ref_entry *entry, void *cb_data) /* This should return a meaningful errno on failure */ int lock_packed_refs(int flags) { + static int timeout_configured = 0; + static int timeout_value = 1000; + struct packed_ref_cache *packed_ref_cache; - if (hold_lock_file_for_update(&packlock, git_path("packed-refs"), flags) < 0) + if (!timeout_configured) { + git_config_get_int("core.packedrefstimeout", &timeout_value); + timeout_configured = 1; + } + + if (hold_lock_file_for_update_timeout( + &packlock, git_path("packed-refs"), + flags, timeout_value) < 0) return -1; /* * Get the current packed-refs while holding the lock. If the |