Skip to content

Commit b3bbbc5

Browse files
mhaggergitster
authored andcommitted
lock_ref_for_update(): add a files_ref_store argument
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent f18a789 commit b3bbbc5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

refs/files-backend.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3482,20 +3482,21 @@ static const char *original_update_refname(struct ref_update *update)
34823482
* - If it is an update of head_ref, add a corresponding REF_LOG_ONLY
34833483
* update of HEAD.
34843484
*/
3485-
static int lock_ref_for_update(struct ref_update *update,
3485+
static int lock_ref_for_update(struct files_ref_store *refs,
3486+
struct ref_update *update,
34863487
struct ref_transaction *transaction,
34873488
const char *head_ref,
34883489
struct string_list *affected_refnames,
34893490
struct strbuf *err)
34903491
{
3491-
struct files_ref_store *refs =
3492-
get_files_ref_store(NULL, "lock_ref_for_update");
34933492
struct strbuf referent = STRBUF_INIT;
34943493
int mustexist = (update->flags & REF_HAVE_OLD) &&
34953494
!is_null_sha1(update->old_sha1);
34963495
int ret;
34973496
struct ref_lock *lock;
34983497

3498+
assert_main_repository(&refs->base, "lock_ref_for_update");
3499+
34993500
if ((update->flags & REF_HAVE_NEW) && is_null_sha1(update->new_sha1))
35003501
update->flags |= REF_DELETING;
35013502

@@ -3720,8 +3721,8 @@ static int files_transaction_commit(struct ref_store *ref_store,
37203721
for (i = 0; i < transaction->nr; i++) {
37213722
struct ref_update *update = transaction->updates[i];
37223723

3723-
ret = lock_ref_for_update(update, transaction, head_ref,
3724-
&affected_refnames, err);
3724+
ret = lock_ref_for_update(refs, update, transaction,
3725+
head_ref, &affected_refnames, err);
37253726
if (ret)
37263727
goto cleanup;
37273728
}

0 commit comments

Comments
 (0)