@@ -196,7 +196,7 @@ static int will_fetch(struct ref **head, const unsigned char *sha1)
196196{
197197 struct ref * rm = * head ;
198198 while (rm ) {
199- if (!hashcmp (rm -> old_sha1 , sha1 ))
199+ if (!hashcmp (rm -> old_oid . hash , sha1 ))
200200 return 1 ;
201201 rm = rm -> next ;
202202 }
@@ -224,8 +224,8 @@ static void find_non_local_tags(struct transport *transport,
224224 * as one to ignore by setting util to NULL.
225225 */
226226 if (ends_with (ref -> name , "^{}" )) {
227- if (item && !has_sha1_file ( ref -> old_sha1 ) &&
228- !will_fetch (head , ref -> old_sha1 ) &&
227+ if (item && !has_object_file ( & ref -> old_oid ) &&
228+ !will_fetch (head , ref -> old_oid . hash ) &&
229229 !has_sha1_file (item -> util ) &&
230230 !will_fetch (head , item -> util ))
231231 item -> util = NULL ;
@@ -251,7 +251,7 @@ static void find_non_local_tags(struct transport *transport,
251251 continue ;
252252
253253 item = string_list_insert (& remote_refs , ref -> name );
254- item -> util = (void * )ref -> old_sha1 ;
254+ item -> util = (void * )& ref -> old_oid ;
255255 }
256256 string_list_clear (& existing_refs , 1 );
257257
@@ -273,7 +273,7 @@ static void find_non_local_tags(struct transport *transport,
273273 {
274274 struct ref * rm = alloc_ref (item -> string );
275275 rm -> peer_ref = alloc_ref (item -> string );
276- hashcpy ( rm -> old_sha1 , item -> util );
276+ oidcpy ( & rm -> old_oid , item -> util );
277277 * * tail = rm ;
278278 * tail = & rm -> next ;
279279 }
@@ -419,8 +419,8 @@ static int s_update_ref(const char *action,
419419 transaction = ref_transaction_begin (& err );
420420 if (!transaction ||
421421 ref_transaction_update (transaction , ref -> name ,
422- ref -> new_sha1 ,
423- check_old ? ref -> old_sha1 : NULL ,
422+ ref -> new_oid . hash ,
423+ check_old ? ref -> old_oid . hash : NULL ,
424424 0 , msg , & err ))
425425 goto fail ;
426426
@@ -453,11 +453,11 @@ static int update_local_ref(struct ref *ref,
453453 struct branch * current_branch = branch_get (NULL );
454454 const char * pretty_ref = prettify_refname (ref -> name );
455455
456- type = sha1_object_info (ref -> new_sha1 , NULL );
456+ type = sha1_object_info (ref -> new_oid . hash , NULL );
457457 if (type < 0 )
458- die (_ ("object %s not found" ), sha1_to_hex ( ref -> new_sha1 ));
458+ die (_ ("object %s not found" ), oid_to_hex ( & ref -> new_oid ));
459459
460- if (!hashcmp ( ref -> old_sha1 , ref -> new_sha1 )) {
460+ if (!oidcmp ( & ref -> old_oid , & ref -> new_oid )) {
461461 if (verbosity > 0 )
462462 strbuf_addf (display , "= %-*s %-*s -> %s" ,
463463 TRANSPORT_SUMMARY (_ ("[up to date]" )),
@@ -468,7 +468,7 @@ static int update_local_ref(struct ref *ref,
468468 if (current_branch &&
469469 !strcmp (ref -> name , current_branch -> name ) &&
470470 !(update_head_ok || is_bare_repository ()) &&
471- !is_null_sha1 ( ref -> old_sha1 )) {
471+ !is_null_oid ( & ref -> old_oid )) {
472472 /*
473473 * If this is the head, and it's not okay to update
474474 * the head, and the old value of the head isn't empty...
@@ -480,7 +480,7 @@ static int update_local_ref(struct ref *ref,
480480 return 1 ;
481481 }
482482
483- if (!is_null_sha1 ( ref -> old_sha1 ) &&
483+ if (!is_null_oid ( & ref -> old_oid ) &&
484484 starts_with (ref -> name , "refs/tags/" )) {
485485 int r ;
486486 r = s_update_ref ("updating tag" , ref , 0 );
@@ -492,8 +492,8 @@ static int update_local_ref(struct ref *ref,
492492 return r ;
493493 }
494494
495- current = lookup_commit_reference_gently (ref -> old_sha1 , 1 );
496- updated = lookup_commit_reference_gently (ref -> new_sha1 , 1 );
495+ current = lookup_commit_reference_gently (ref -> old_oid . hash , 1 );
496+ updated = lookup_commit_reference_gently (ref -> new_oid . hash , 1 );
497497 if (!current || !updated ) {
498498 const char * msg ;
499499 const char * what ;
@@ -517,7 +517,7 @@ static int update_local_ref(struct ref *ref,
517517
518518 if ((recurse_submodules != RECURSE_SUBMODULES_OFF ) &&
519519 (recurse_submodules != RECURSE_SUBMODULES_ON ))
520- check_for_new_submodule_commits (ref -> new_sha1 );
520+ check_for_new_submodule_commits (ref -> new_oid . hash );
521521 r = s_update_ref (msg , ref , 0 );
522522 strbuf_addf (display , "%c %-*s %-*s -> %s%s" ,
523523 r ? '!' : '*' ,
@@ -532,10 +532,10 @@ static int update_local_ref(struct ref *ref,
532532 int r ;
533533 strbuf_add_unique_abbrev (& quickref , current -> object .sha1 , DEFAULT_ABBREV );
534534 strbuf_addstr (& quickref , ".." );
535- strbuf_add_unique_abbrev (& quickref , ref -> new_sha1 , DEFAULT_ABBREV );
535+ strbuf_add_unique_abbrev (& quickref , ref -> new_oid . hash , DEFAULT_ABBREV );
536536 if ((recurse_submodules != RECURSE_SUBMODULES_OFF ) &&
537537 (recurse_submodules != RECURSE_SUBMODULES_ON ))
538- check_for_new_submodule_commits (ref -> new_sha1 );
538+ check_for_new_submodule_commits (ref -> new_oid . hash );
539539 r = s_update_ref ("fast-forward" , ref , 1 );
540540 strbuf_addf (display , "%c %-*s %-*s -> %s%s" ,
541541 r ? '!' : ' ' ,
@@ -549,10 +549,10 @@ static int update_local_ref(struct ref *ref,
549549 int r ;
550550 strbuf_add_unique_abbrev (& quickref , current -> object .sha1 , DEFAULT_ABBREV );
551551 strbuf_addstr (& quickref , "..." );
552- strbuf_add_unique_abbrev (& quickref , ref -> new_sha1 , DEFAULT_ABBREV );
552+ strbuf_add_unique_abbrev (& quickref , ref -> new_oid . hash , DEFAULT_ABBREV );
553553 if ((recurse_submodules != RECURSE_SUBMODULES_OFF ) &&
554554 (recurse_submodules != RECURSE_SUBMODULES_ON ))
555- check_for_new_submodule_commits (ref -> new_sha1 );
555+ check_for_new_submodule_commits (ref -> new_oid . hash );
556556 r = s_update_ref ("forced-update" , ref , 1 );
557557 strbuf_addf (display , "%c %-*s %-*s -> %s (%s)" ,
558558 r ? '!' : '+' ,
@@ -580,7 +580,7 @@ static int iterate_ref_map(void *cb_data, unsigned char sha1[20])
580580 if (!ref )
581581 return -1 ; /* end of the list */
582582 * rm = ref -> next ;
583- hashcpy (sha1 , ref -> old_sha1 );
583+ hashcpy (sha1 , ref -> old_oid . hash );
584584 return 0 ;
585585}
586586
@@ -631,7 +631,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
631631 continue ;
632632 }
633633
634- commit = lookup_commit_reference_gently (rm -> old_sha1 , 1 );
634+ commit = lookup_commit_reference_gently (rm -> old_oid . hash , 1 );
635635 if (!commit )
636636 rm -> fetch_head_status = FETCH_HEAD_NOT_FOR_MERGE ;
637637
@@ -640,8 +640,8 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
640640
641641 if (rm -> peer_ref ) {
642642 ref = alloc_ref (rm -> peer_ref -> name );
643- hashcpy ( ref -> old_sha1 , rm -> peer_ref -> old_sha1 );
644- hashcpy ( ref -> new_sha1 , rm -> old_sha1 );
643+ oidcpy ( & ref -> old_oid , & rm -> peer_ref -> old_oid );
644+ oidcpy ( & ref -> new_oid , & rm -> old_oid );
645645 ref -> force = rm -> peer_ref -> force ;
646646 }
647647
@@ -686,7 +686,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
686686 /* fall-through */
687687 case FETCH_HEAD_MERGE :
688688 fprintf (fp , "%s\t%s\t%s" ,
689- sha1_to_hex ( rm -> old_sha1 ),
689+ oid_to_hex ( & rm -> old_oid ),
690690 merge_status_marker ,
691691 note .buf );
692692 for (i = 0 ; i < url_len ; ++ i )
@@ -928,7 +928,7 @@ static int do_fetch(struct transport *transport,
928928 rm -> peer_ref -> name );
929929 if (peer_item ) {
930930 struct object_id * old_oid = peer_item -> util ;
931- hashcpy ( rm -> peer_ref -> old_sha1 , old_oid -> hash );
931+ oidcpy ( & rm -> peer_ref -> old_oid , old_oid );
932932 }
933933 }
934934 }
0 commit comments