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>
Michael Haggerty committed
Sep 4, 2016 at 18:08 UTC
b3bbbc5c245b2599f3b53122f2bb57a054027413
1 file changed
+6
-5
refs/files-backend.c
+6
-5
@@ -3482,20 +3482,21 @@ static const char *original_update_refname(struct ref_update *update)
3482
* - If it is an update of head_ref, add a corresponding REF_LOG_ONLY
3483
* update of HEAD.
3484
*/
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,
3487
struct ref_transaction *transaction,
3488
const char *head_ref,
3489
struct string_list *affected_refnames,
3490
struct strbuf *err)
3491
{
3491
- struct files_ref_store *refs =
3492
- get_files_ref_store(NULL, "lock_ref_for_update");
3492
struct strbuf referent = STRBUF_INIT;
3493
int mustexist = (update->flags & REF_HAVE_OLD) &&
3494
!is_null_sha1(update->old_sha1);
3495
int ret;
3496
struct ref_lock *lock;
3497
3498
+ assert_main_repository(&refs->base, "lock_ref_for_update");
3499
+
3500
if ((update->flags & REF_HAVE_NEW) && is_null_sha1(update->new_sha1))
3501
update->flags |= REF_DELETING;
3502
@@ -3720,8 +3721,8 @@ static int files_transaction_commit(struct ref_store *ref_store,
3721
for (i = 0; i < transaction->nr; i++) {
3722
struct ref_update *update = transaction->updates[i];
3723
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);
3726
if (ret)
3727
goto cleanup;
3728
}