packed_refs_lock(): function renamed from lock_packed_refs()
Rename `lock_packed_refs()` to `packed_refs_lock()` for consistency with how other methods are named. Also, it's about to get some companions. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
42dfa7ecef
commit
b7de57d8d1
@ -1096,7 +1096,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
|
|||||||
struct ref_to_prune *refs_to_prune = NULL;
|
struct ref_to_prune *refs_to_prune = NULL;
|
||||||
struct strbuf err = STRBUF_INIT;
|
struct strbuf err = STRBUF_INIT;
|
||||||
|
|
||||||
lock_packed_refs(refs->packed_ref_store, LOCK_DIE_ON_ERROR);
|
packed_refs_lock(refs->packed_ref_store, LOCK_DIE_ON_ERROR);
|
||||||
|
|
||||||
iter = cache_ref_iterator_begin(get_loose_ref_cache(refs), NULL, 0);
|
iter = cache_ref_iterator_begin(get_loose_ref_cache(refs), NULL, 0);
|
||||||
while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
|
while ((ok = ref_iterator_advance(iter)) == ITER_OK) {
|
||||||
@ -2679,7 +2679,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lock_packed_refs(refs->packed_ref_store, 0)) {
|
if (packed_refs_lock(refs->packed_ref_store, 0)) {
|
||||||
strbuf_addf(err, "unable to lock packed-refs file: %s",
|
strbuf_addf(err, "unable to lock packed-refs file: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
ret = TRANSACTION_GENERIC_ERROR;
|
ret = TRANSACTION_GENERIC_ERROR;
|
||||||
|
@ -321,7 +321,7 @@ static struct ref_dir *get_packed_refs(struct packed_ref_store *refs)
|
|||||||
/*
|
/*
|
||||||
* Add or overwrite a reference in the in-memory packed reference
|
* Add or overwrite a reference in the in-memory packed reference
|
||||||
* cache. This may only be called while the packed-refs file is locked
|
* cache. This may only be called while the packed-refs file is locked
|
||||||
* (see lock_packed_refs()). To actually write the packed-refs file,
|
* (see packed_refs_lock()). To actually write the packed-refs file,
|
||||||
* call commit_packed_refs().
|
* call commit_packed_refs().
|
||||||
*/
|
*/
|
||||||
void add_packed_ref(struct ref_store *ref_store,
|
void add_packed_ref(struct ref_store *ref_store,
|
||||||
@ -515,11 +515,11 @@ static int write_packed_entry(FILE *fh, const char *refname,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lock_packed_refs(struct ref_store *ref_store, int flags)
|
int packed_refs_lock(struct ref_store *ref_store, int flags)
|
||||||
{
|
{
|
||||||
struct packed_ref_store *refs =
|
struct packed_ref_store *refs =
|
||||||
packed_downcast(ref_store, REF_STORE_WRITE | REF_STORE_MAIN,
|
packed_downcast(ref_store, REF_STORE_WRITE | REF_STORE_MAIN,
|
||||||
"lock_packed_refs");
|
"packed_refs_lock");
|
||||||
static int timeout_configured = 0;
|
static int timeout_configured = 0;
|
||||||
static int timeout_value = 1000;
|
static int timeout_value = 1000;
|
||||||
struct packed_ref_cache *packed_ref_cache;
|
struct packed_ref_cache *packed_ref_cache;
|
||||||
@ -567,7 +567,7 @@ static const char PACKED_REFS_HEADER[] =
|
|||||||
/*
|
/*
|
||||||
* Write the current version of the packed refs cache from memory to
|
* Write the current version of the packed refs cache from memory to
|
||||||
* disk. The packed-refs file must already be locked for writing (see
|
* disk. The packed-refs file must already be locked for writing (see
|
||||||
* lock_packed_refs()). Return zero on success. On errors, rollback
|
* packed_refs_lock()). Return zero on success. On errors, rollback
|
||||||
* the lockfile, write an error message to `err`, and return a nonzero
|
* the lockfile, write an error message to `err`, and return a nonzero
|
||||||
* value.
|
* value.
|
||||||
*/
|
*/
|
||||||
@ -698,7 +698,7 @@ int repack_without_refs(struct ref_store *ref_store,
|
|||||||
if (!needs_repacking)
|
if (!needs_repacking)
|
||||||
return 0; /* no refname exists in packed refs */
|
return 0; /* no refname exists in packed refs */
|
||||||
|
|
||||||
if (lock_packed_refs(&refs->base, 0)) {
|
if (packed_refs_lock(&refs->base, 0)) {
|
||||||
unable_to_lock_message(refs->path, errno, err);
|
unable_to_lock_message(refs->path, errno, err);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ struct ref_store *packed_ref_store_create(const char *path,
|
|||||||
* hold_lock_file_for_update(). Return 0 on success. On errors, set
|
* hold_lock_file_for_update(). Return 0 on success. On errors, set
|
||||||
* errno appropriately and return a nonzero value.
|
* errno appropriately and return a nonzero value.
|
||||||
*/
|
*/
|
||||||
int lock_packed_refs(struct ref_store *ref_store, int flags);
|
int packed_refs_lock(struct ref_store *ref_store, int flags);
|
||||||
|
|
||||||
void add_packed_ref(struct ref_store *ref_store,
|
void add_packed_ref(struct ref_store *ref_store,
|
||||||
const char *refname, const struct object_id *oid);
|
const char *refname, const struct object_id *oid);
|
||||||
|
Reference in New Issue
Block a user