Re: [PATCH 37/38] refs: make lock generic
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 7, 2016, 17:50 UTC
- Message-ID
- <xmqqlh2griq3.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <d2a3cb56d7276c00174a08fe609d63e00755b205.1464983301.git.mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 5 quoted lines
> From: David Turner <dturner@twopensource.com> > > Instead of including a files-backend-specific struct ref_lock, change > the generic ref_update struct to include a void pointer that backends > can use for their own arbitrary data.
Hmph.
Show 15 quoted lines
> @@ -3591,7 +3590,8 @@ static int lock_ref_for_update(struct files_ref_store *refs,
> for (parent_update = update->parent_update;
> parent_update;
> parent_update = parent_update->parent_update) {
> - oidcpy(&parent_update->lock->old_oid, &lock->old_oid);
> + struct ref_lock *parent_lock = parent_update->backend_data;
> + oidcpy(&parent_lock->old_oid, &lock->old_oid);
> }
> ...
> @@ -3745,7 +3745,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
> /* Perform updates first so live commits remain referenced */
> for (i = 0; i < transaction->nr; i++) {
> struct ref_update *update = updates[i];
> - struct ref_lock *lock = update->lock;
> + struct ref_lock *lock = update->backend_data;OK, and files_* backend method downcasts it to what it wants, which is good.