@@ -303,7 +303,12 @@ static int check_to_send_update(const struct ref *ref, const struct send_pack_ar
303
303
return CHECK_REF_STATUS_REJECTED ;
304
304
case REF_STATUS_UPTODATE :
305
305
return CHECK_REF_UPTODATE ;
306
+
306
307
default :
308
+ case REF_STATUS_EXPECTING_REPORT :
309
+ /* already passed checks on the local side */
310
+ case REF_STATUS_OK :
311
+ /* of course this is OK */
307
312
return 0 ;
308
313
}
309
314
}
@@ -510,13 +515,6 @@ int send_pack(struct send_pack_args *args,
510
515
if (ref -> deletion && !allow_deleting_refs )
511
516
ref -> status = REF_STATUS_REJECT_NODELETE ;
512
517
513
- if (!args -> dry_run )
514
- advertise_shallow_grafts_buf (& req_buf );
515
-
516
- if (!args -> dry_run && push_cert_nonce )
517
- cmds_sent = generate_push_cert (& req_buf , remote_refs , args ,
518
- cap_buf .buf , push_cert_nonce );
519
-
520
518
/*
521
519
* Clear the status for each ref and see if we need to send
522
520
* the pack data.
@@ -552,31 +550,35 @@ int send_pack(struct send_pack_args *args,
552
550
ref -> status = REF_STATUS_EXPECTING_REPORT ;
553
551
}
554
552
553
+ if (!args -> dry_run )
554
+ advertise_shallow_grafts_buf (& req_buf );
555
+
555
556
/*
556
557
* Finally, tell the other end!
557
558
*/
558
- for (ref = remote_refs ; ref ; ref = ref -> next ) {
559
- char * old_hex , * new_hex ;
560
-
561
- if (args -> dry_run || push_cert_nonce )
562
- continue ;
559
+ if (!args -> dry_run && push_cert_nonce )
560
+ cmds_sent = generate_push_cert (& req_buf , remote_refs , args ,
561
+ cap_buf .buf , push_cert_nonce );
562
+ else if (!args -> dry_run )
563
+ for (ref = remote_refs ; ref ; ref = ref -> next ) {
564
+ char * old_hex , * new_hex ;
563
565
564
- if (check_to_send_update (ref , args ) < 0 )
565
- continue ;
566
+ if (check_to_send_update (ref , args ) < 0 )
567
+ continue ;
566
568
567
- old_hex = oid_to_hex (& ref -> old_oid );
568
- new_hex = oid_to_hex (& ref -> new_oid );
569
- if (!cmds_sent ) {
570
- packet_buf_write (& req_buf ,
571
- "%s %s %s%c%s" ,
572
- old_hex , new_hex , ref -> name , 0 ,
573
- cap_buf .buf );
574
- cmds_sent = 1 ;
575
- } else {
576
- packet_buf_write (& req_buf , "%s %s %s" ,
577
- old_hex , new_hex , ref -> name );
569
+ old_hex = oid_to_hex (& ref -> old_oid );
570
+ new_hex = oid_to_hex (& ref -> new_oid );
571
+ if (!cmds_sent ) {
572
+ packet_buf_write (& req_buf ,
573
+ "%s %s %s%c%s" ,
574
+ old_hex , new_hex , ref -> name , 0 ,
575
+ cap_buf .buf );
576
+ cmds_sent = 1 ;
577
+ } else {
578
+ packet_buf_write (& req_buf , "%s %s %s" ,
579
+ old_hex , new_hex , ref -> name );
580
+ }
578
581
}
579
- }
580
582
581
583
if (use_push_options ) {
582
584
struct string_list_item * item ;
0 commit comments