@@ -2633,7 +2633,7 @@ static int split_head_update(struct ref_update *update,
26332633 new_update = ref_transaction_add_update (
26342634 transaction , "HEAD" ,
26352635 update -> flags | REF_LOG_ONLY | REF_NODEREF ,
2636- update -> new_sha1 , update -> old_sha1 ,
2636+ update -> new_oid . hash , update -> old_oid . hash ,
26372637 update -> msg );
26382638
26392639 item -> util = new_update ;
@@ -2690,7 +2690,7 @@ static int split_symref_update(struct files_ref_store *refs,
26902690
26912691 new_update = ref_transaction_add_update (
26922692 transaction , referent , new_flags ,
2693- update -> new_sha1 , update -> old_sha1 ,
2693+ update -> new_oid . hash , update -> old_oid . hash ,
26942694 update -> msg );
26952695
26962696 new_update -> parent_update = update ;
@@ -2729,24 +2729,24 @@ static int check_old_oid(struct ref_update *update, struct object_id *oid,
27292729 struct strbuf * err )
27302730{
27312731 if (!(update -> flags & REF_HAVE_OLD ) ||
2732- !hashcmp (oid -> hash , update -> old_sha1 ))
2732+ !oidcmp (oid , & update -> old_oid ))
27332733 return 0 ;
27342734
2735- if (is_null_sha1 ( update -> old_sha1 ))
2735+ if (is_null_oid ( & update -> old_oid ))
27362736 strbuf_addf (err , "cannot lock ref '%s': "
27372737 "reference already exists" ,
27382738 original_update_refname (update ));
27392739 else if (is_null_oid (oid ))
27402740 strbuf_addf (err , "cannot lock ref '%s': "
27412741 "reference is missing but expected %s" ,
27422742 original_update_refname (update ),
2743- sha1_to_hex ( update -> old_sha1 ));
2743+ oid_to_hex ( & update -> old_oid ));
27442744 else
27452745 strbuf_addf (err , "cannot lock ref '%s': "
27462746 "is at %s but expected %s" ,
27472747 original_update_refname (update ),
27482748 oid_to_hex (oid ),
2749- sha1_to_hex ( update -> old_sha1 ));
2749+ oid_to_hex ( & update -> old_oid ));
27502750
27512751 return -1 ;
27522752}
@@ -2773,13 +2773,13 @@ static int lock_ref_for_update(struct files_ref_store *refs,
27732773{
27742774 struct strbuf referent = STRBUF_INIT ;
27752775 int mustexist = (update -> flags & REF_HAVE_OLD ) &&
2776- !is_null_sha1 ( update -> old_sha1 );
2776+ !is_null_oid ( & update -> old_oid );
27772777 int ret ;
27782778 struct ref_lock * lock ;
27792779
27802780 files_assert_main_repository (refs , "lock_ref_for_update" );
27812781
2782- if ((update -> flags & REF_HAVE_NEW ) && is_null_sha1 ( update -> new_sha1 ))
2782+ if ((update -> flags & REF_HAVE_NEW ) && is_null_oid ( & update -> new_oid ))
27832783 update -> flags |= REF_DELETING ;
27842784
27852785 if (head_ref ) {
@@ -2861,12 +2861,12 @@ static int lock_ref_for_update(struct files_ref_store *refs,
28612861 !(update -> flags & REF_DELETING ) &&
28622862 !(update -> flags & REF_LOG_ONLY )) {
28632863 if (!(update -> type & REF_ISSYMREF ) &&
2864- !hashcmp ( lock -> old_oid . hash , update -> new_sha1 )) {
2864+ !oidcmp ( & lock -> old_oid , & update -> new_oid )) {
28652865 /*
28662866 * The reference already has the desired
28672867 * value, so we don't need to write it.
28682868 */
2869- } else if (write_ref_to_lockfile (lock , update -> new_sha1 ,
2869+ } else if (write_ref_to_lockfile (lock , update -> new_oid . hash ,
28702870 err )) {
28712871 char * write_err = strbuf_detach (err , NULL );
28722872
@@ -3002,7 +3002,7 @@ static int files_transaction_commit(struct ref_store *ref_store,
30023002 if (files_log_ref_write (refs ,
30033003 lock -> ref_name ,
30043004 lock -> old_oid .hash ,
3005- update -> new_sha1 ,
3005+ update -> new_oid . hash ,
30063006 update -> msg , update -> flags ,
30073007 err )) {
30083008 char * old_msg = strbuf_detach (err , NULL );
@@ -3151,7 +3151,7 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
31513151 struct ref_update * update = transaction -> updates [i ];
31523152
31533153 if ((update -> flags & REF_HAVE_OLD ) &&
3154- !is_null_sha1 ( update -> old_sha1 ))
3154+ !is_null_oid ( & update -> old_oid ))
31553155 die ("BUG: initial ref transaction with old_sha1 set" );
31563156 if (refs_verify_refname_available (& refs -> base , update -> refname ,
31573157 & affected_refnames , NULL ,
@@ -3172,8 +3172,9 @@ static int files_initial_transaction_commit(struct ref_store *ref_store,
31723172 struct ref_update * update = transaction -> updates [i ];
31733173
31743174 if ((update -> flags & REF_HAVE_NEW ) &&
3175- !is_null_sha1 (update -> new_sha1 ))
3176- add_packed_ref (refs , update -> refname , update -> new_sha1 );
3175+ !is_null_oid (& update -> new_oid ))
3176+ add_packed_ref (refs , update -> refname ,
3177+ update -> new_oid .hash );
31773178 }
31783179
31793180 if (commit_packed_refs (refs )) {
0 commit comments