@@ -3520,9 +3520,8 @@ static int lock_ref_for_update(struct files_ref_store *refs,
35203520
35213521 ret = lock_raw_ref (refs , update -> refname , mustexist ,
35223522 affected_refnames , NULL ,
3523- & update -> lock , & referent ,
3523+ & lock , & referent ,
35243524 & update -> type , err );
3525-
35263525 if (ret ) {
35273526 char * reason ;
35283527
@@ -3533,7 +3532,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
35333532 return ret ;
35343533 }
35353534
3536- lock = update -> lock ;
3535+ update -> backend_data = lock ;
35373536
35383537 if (update -> type & REF_ISSYMREF ) {
35393538 if (update -> flags & REF_NODEREF ) {
@@ -3589,7 +3588,8 @@ static int lock_ref_for_update(struct files_ref_store *refs,
35893588 for (parent_update = update -> parent_update ;
35903589 parent_update ;
35913590 parent_update = parent_update -> parent_update ) {
3592- oidcpy (& parent_update -> lock -> old_oid , & lock -> old_oid );
3591+ struct ref_lock * parent_lock = parent_update -> backend_data ;
3592+ oidcpy (& parent_lock -> old_oid , & lock -> old_oid );
35933593 }
35943594
35953595 if ((update -> flags & REF_HAVE_OLD ) &&
@@ -3624,7 +3624,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
36243624 * The lock was freed upon failure of
36253625 * write_ref_to_lockfile():
36263626 */
3627- update -> lock = NULL ;
3627+ update -> backend_data = NULL ;
36283628 strbuf_addf (err ,
36293629 "cannot update the ref '%s': %s" ,
36303630 update -> refname , write_err );
@@ -3742,7 +3742,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
37423742 /* Perform updates first so live commits remain referenced */
37433743 for (i = 0 ; i < transaction -> nr ; i ++ ) {
37443744 struct ref_update * update = transaction -> updates [i ];
3745- struct ref_lock * lock = update -> lock ;
3745+ struct ref_lock * lock = update -> backend_data ;
37463746
37473747 if (update -> flags & REF_NEEDS_COMMIT ||
37483748 update -> flags & REF_LOG_ONLY ) {
@@ -3755,7 +3755,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
37553755 lock -> ref_name , old_msg );
37563756 free (old_msg );
37573757 unlock_ref (lock );
3758- update -> lock = NULL ;
3758+ update -> backend_data = NULL ;
37593759 ret = TRANSACTION_GENERIC_ERROR ;
37603760 goto cleanup ;
37613761 }
@@ -3765,7 +3765,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
37653765 if (commit_ref (lock )) {
37663766 strbuf_addf (err , "couldn't set '%s'" , lock -> ref_name );
37673767 unlock_ref (lock );
3768- update -> lock = NULL ;
3768+ update -> backend_data = NULL ;
37693769 ret = TRANSACTION_GENERIC_ERROR ;
37703770 goto cleanup ;
37713771 }
@@ -3774,17 +3774,18 @@ static int files_transaction_commit(struct ref_store *ref_store,
37743774 /* Perform deletes now that updates are safely completed */
37753775 for (i = 0 ; i < transaction -> nr ; i ++ ) {
37763776 struct ref_update * update = transaction -> updates [i ];
3777+ struct ref_lock * lock = update -> backend_data ;
37773778
37783779 if (update -> flags & REF_DELETING &&
37793780 !(update -> flags & REF_LOG_ONLY )) {
3780- if (delete_ref_loose (update -> lock , update -> type , err )) {
3781+ if (delete_ref_loose (lock , update -> type , err )) {
37813782 ret = TRANSACTION_GENERIC_ERROR ;
37823783 goto cleanup ;
37833784 }
37843785
37853786 if (!(update -> flags & REF_ISPRUNING ))
37863787 string_list_append (& refs_to_delete ,
3787- update -> lock -> ref_name );
3788+ lock -> ref_name );
37883789 }
37893790 }
37903791
@@ -3800,8 +3801,8 @@ static int files_transaction_commit(struct ref_store *ref_store,
38003801 transaction -> state = REF_TRANSACTION_CLOSED ;
38013802
38023803 for (i = 0 ; i < transaction -> nr ; i ++ )
3803- if (transaction -> updates [i ]-> lock )
3804- unlock_ref (transaction -> updates [i ]-> lock );
3804+ if (transaction -> updates [i ]-> backend_data )
3805+ unlock_ref (transaction -> updates [i ]-> backend_data );
38053806 string_list_clear (& refs_to_delete , 0 );
38063807 free (head_ref );
38073808 string_list_clear (& affected_refnames , 0 );
0 commit comments