@@ -681,9 +681,9 @@ static void receive_needs(void)
681
681
}
682
682
683
683
/* 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 )
685
685
{
686
- struct object * o = lookup_unknown_object (sha1 );
686
+ struct object * o = lookup_unknown_object (oid -> hash );
687
687
688
688
if (ref_is_hidden (refname )) {
689
689
o -> flags |= HIDDEN_REF ;
@@ -693,9 +693,10 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1)
693
693
return 0 ;
694
694
}
695
695
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 )
697
698
{
698
- mark_our_ref (refname , sha1 );
699
+ mark_our_ref (refname , oid );
699
700
return 0 ;
700
701
}
701
702
@@ -709,31 +710,32 @@ static void format_symref_info(struct strbuf *buf, struct string_list *symref)
709
710
strbuf_addf (buf , " symref=%s:%s" , item -> string , (char * )item -> util );
710
711
}
711
712
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 )
713
715
{
714
716
static const char * capabilities = "multi_ack thin-pack side-band"
715
717
" side-band-64k ofs-delta shallow no-progress"
716
718
" include-tag multi_ack_detailed" ;
717
719
const char * refname_nons = strip_namespace (refname );
718
720
unsigned char peeled [20 ];
719
721
720
- if (mark_our_ref (refname , sha1 ))
722
+ if (mark_our_ref (refname , oid ))
721
723
return 0 ;
722
724
723
725
if (capabilities ) {
724
726
struct strbuf symref_info = STRBUF_INIT ;
725
727
726
728
format_symref_info (& symref_info , cb_data );
727
729
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 ,
729
731
0 , capabilities ,
730
732
allow_tip_sha1_in_want ? " allow-tip-sha1-in-want" : "" ,
731
733
stateless_rpc ? " no-done" : "" ,
732
734
symref_info .buf ,
733
735
git_user_agent_sanitized ());
734
736
strbuf_release (& symref_info );
735
737
} 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 );
737
739
}
738
740
capabilities = NULL ;
739
741
if (!peel_ref (refname , peeled ))
@@ -765,20 +767,14 @@ static void upload_pack(void)
765
767
head_ref_namespaced (find_symref , & symref );
766
768
767
769
if (advertise_refs || !stateless_rpc ) {
768
- struct each_ref_fn_sha1_adapter wrapped_send_ref =
769
- {send_ref , & symref };
770
-
771
770
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 );
774
773
advertise_shallow_grafts (1 );
775
774
packet_flush (1 );
776
775
} 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 );
782
778
}
783
779
string_list_clear (& symref , 1 );
784
780
if (advertise_refs )
0 commit comments