mirror of
https://github.com/git/git.git
synced 2026-08-09 01:21:47 +00:00
use repo_hold_lock_file_for_update{,_mode,_timeout}() with custom repos
Apply the config setting core.sharedRepository from the repository at hand instead of from the_repository. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
75e05f6bc3
commit
2e486bfbf7
@@ -791,7 +791,7 @@ retry:
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
if (hold_lock_file_for_update_timeout(
|
||||
if (repo_hold_lock_file_for_update_timeout(refs->base.repo,
|
||||
&lock->lk, ref_file.buf, LOCK_NO_DEREF,
|
||||
get_files_ref_lock_timeout_ms(transaction->ref_store->repo)) < 0) {
|
||||
int myerr = errno;
|
||||
@@ -1199,8 +1199,8 @@ struct create_reflock_cb {
|
||||
static int create_reflock(const char *path, void *cb)
|
||||
{
|
||||
struct create_reflock_cb *data = cb;
|
||||
return hold_lock_file_for_update_timeout(
|
||||
data->lk, path, LOCK_NO_DEREF,
|
||||
return repo_hold_lock_file_for_update_timeout(
|
||||
data->repo, data->lk, path, LOCK_NO_DEREF,
|
||||
get_files_ref_lock_timeout_ms(data->repo)) < 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
@@ -3529,7 +3529,9 @@ static int files_reflog_expire(struct ref_store *ref_store,
|
||||
* work we need, including cleaning up if the program
|
||||
* exits unexpectedly.
|
||||
*/
|
||||
if (hold_lock_file_for_update(&reflog_lock, log_file, 0) < 0) {
|
||||
if (repo_hold_lock_file_for_update(ref_store->repo,
|
||||
&reflog_lock, log_file,
|
||||
0) < 0) {
|
||||
struct strbuf err = STRBUF_INIT;
|
||||
unable_to_lock_message(log_file, errno, &err);
|
||||
error("%s", err.buf);
|
||||
|
||||
@@ -1232,10 +1232,9 @@ int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err)
|
||||
* don't write new content to it, but rather to a separate
|
||||
* tempfile.
|
||||
*/
|
||||
if (hold_lock_file_for_update_timeout(
|
||||
&refs->lock,
|
||||
refs->path,
|
||||
flags, timeout_value) < 0) {
|
||||
if (repo_hold_lock_file_for_update_timeout(ref_store->repo, &refs->lock,
|
||||
refs->path, flags,
|
||||
timeout_value) < 0) {
|
||||
unable_to_lock_message(refs->path, errno, err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ struct ref_store *packed_ref_store_init(struct repository *repo,
|
||||
|
||||
/*
|
||||
* Lock the packed-refs file for writing. Flags is passed to
|
||||
* hold_lock_file_for_update(). Return 0 on success. On errors, write
|
||||
* repo_hold_lock_file_for_update(). Return 0 on success. On errors, write
|
||||
* an error message to `err` and return a nonzero value.
|
||||
*/
|
||||
int packed_refs_lock(struct ref_store *ref_store, int flags, struct strbuf *err);
|
||||
|
||||
Reference in New Issue
Block a user