@@ -681,9 +681,9 @@ static void receive_needs(void)
681681}
682682
683683/* return non-zero if the ref is hidden, otherwise 0 */
684- static int mark_our_ref (const char * refname , const unsigned char * sha1 )
684+ static int mark_our_ref (const char * refname , const struct object_id * oid )
685685{
686- struct object * o = lookup_unknown_object (sha1 );
686+ struct object * o = lookup_unknown_object (oid -> hash );
687687
688688 if (ref_is_hidden (refname )) {
689689 o -> flags |= HIDDEN_REF ;
@@ -693,9 +693,10 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1)
693693 return 0 ;
694694}
695695
696- static int check_ref (const char * refname , const unsigned char * sha1 , int flag , void * cb_data )
696+ static int check_ref (const char * refname , const struct object_id * oid ,
697+ int flag , void * cb_data )
697698{
698- mark_our_ref (refname , sha1 );
699+ mark_our_ref (refname , oid );
699700 return 0 ;
700701}
701702
@@ -709,31 +710,32 @@ static void format_symref_info(struct strbuf *buf, struct string_list *symref)
709710 strbuf_addf (buf , " symref=%s:%s" , item -> string , (char * )item -> util );
710711}
711712
712- static int send_ref (const char * refname , const unsigned char * sha1 , int flag , void * cb_data )
713+ static int send_ref (const char * refname , const struct object_id * oid ,
714+ int flag , void * cb_data )
713715{
714716 static const char * capabilities = "multi_ack thin-pack side-band"
715717 " side-band-64k ofs-delta shallow no-progress"
716718 " include-tag multi_ack_detailed" ;
717719 const char * refname_nons = strip_namespace (refname );
718720 unsigned char peeled [20 ];
719721
720- if (mark_our_ref (refname , sha1 ))
722+ if (mark_our_ref (refname , oid ))
721723 return 0 ;
722724
723725 if (capabilities ) {
724726 struct strbuf symref_info = STRBUF_INIT ;
725727
726728 format_symref_info (& symref_info , cb_data );
727729 packet_write (1 , "%s %s%c%s%s%s%s agent=%s\n" ,
728- sha1_to_hex ( sha1 ), refname_nons ,
730+ oid_to_hex ( oid ), refname_nons ,
729731 0 , capabilities ,
730732 allow_tip_sha1_in_want ? " allow-tip-sha1-in-want" : "" ,
731733 stateless_rpc ? " no-done" : "" ,
732734 symref_info .buf ,
733735 git_user_agent_sanitized ());
734736 strbuf_release (& symref_info );
735737 } else {
736- packet_write (1 , "%s %s\n" , sha1_to_hex ( sha1 ), refname_nons );
738+ packet_write (1 , "%s %s\n" , oid_to_hex ( oid ), refname_nons );
737739 }
738740 capabilities = NULL ;
739741 if (!peel_ref (refname , peeled ))
@@ -765,20 +767,14 @@ static void upload_pack(void)
765767 head_ref_namespaced (find_symref , & symref );
766768
767769 if (advertise_refs || !stateless_rpc ) {
768- struct each_ref_fn_sha1_adapter wrapped_send_ref =
769- {send_ref , & symref };
770-
771770 reset_timeout ();
772- head_ref_namespaced (each_ref_fn_adapter , & wrapped_send_ref );
773- for_each_namespaced_ref (each_ref_fn_adapter , & wrapped_send_ref );
771+ head_ref_namespaced (send_ref , & symref );
772+ for_each_namespaced_ref (send_ref , & symref );
774773 advertise_shallow_grafts (1 );
775774 packet_flush (1 );
776775 } else {
777- struct each_ref_fn_sha1_adapter wrapped_check_ref =
778- {check_ref , NULL };
779-
780- head_ref_namespaced (each_ref_fn_adapter , & wrapped_check_ref );
781- for_each_namespaced_ref (each_ref_fn_adapter , & wrapped_check_ref );
776+ head_ref_namespaced (check_ref , NULL );
777+ for_each_namespaced_ref (check_ref , NULL );
782778 }
783779 string_list_clear (& symref , 1 );
784780 if (advertise_refs )
0 commit comments