@@ -312,19 +312,21 @@ static int find_common(struct fetch_negotiator *negotiator,
312
312
const char * remote_hex ;
313
313
struct object * o ;
314
314
315
- /*
316
- * If that object is complete (i.e. it is an ancestor of a
317
- * local ref), we tell them we have it but do not have to
318
- * tell them about its ancestors, which they already know
319
- * about.
320
- *
321
- * We use lookup_object here because we are only
322
- * interested in the case we *know* the object is
323
- * reachable and we have already scanned it.
324
- */
325
- if (((o = lookup_object (the_repository , remote )) != NULL ) &&
326
- (o -> flags & COMPLETE )) {
327
- continue ;
315
+ if (!args -> refetch ) {
316
+ /*
317
+ * If that object is complete (i.e. it is an ancestor of a
318
+ * local ref), we tell them we have it but do not have to
319
+ * tell them about its ancestors, which they already know
320
+ * about.
321
+ *
322
+ * We use lookup_object here because we are only
323
+ * interested in the case we *know* the object is
324
+ * reachable and we have already scanned it.
325
+ */
326
+ if (((o = lookup_object (the_repository , remote )) != NULL ) &&
327
+ (o -> flags & COMPLETE )) {
328
+ continue ;
329
+ }
328
330
}
329
331
330
332
remote_hex = oid_to_hex (remote );
@@ -692,6 +694,9 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
692
694
int old_save_commit_buffer = save_commit_buffer ;
693
695
timestamp_t cutoff = 0 ;
694
696
697
+ if (args -> refetch )
698
+ return ;
699
+
695
700
save_commit_buffer = 0 ;
696
701
697
702
trace2_region_enter ("fetch-pack" , "parse_remote_refs_and_find_cutoff" , NULL );
@@ -1028,7 +1033,11 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
1028
1033
struct fetch_negotiator * negotiator ;
1029
1034
1030
1035
negotiator = & negotiator_alloc ;
1031
- fetch_negotiator_init (r , negotiator );
1036
+ if (args -> refetch ) {
1037
+ fetch_negotiator_init_noop (negotiator );
1038
+ } else {
1039
+ fetch_negotiator_init (r , negotiator );
1040
+ }
1032
1041
1033
1042
sort_ref_list (& ref , ref_compare_name );
1034
1043
QSORT (sought , nr_sought , cmp_ref_by_name );
@@ -1121,7 +1130,7 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
1121
1130
1122
1131
mark_complete_and_common_ref (negotiator , args , & ref );
1123
1132
filter_refs (args , & ref , sought , nr_sought );
1124
- if (everything_local (args , & ref )) {
1133
+ if (! args -> refetch && everything_local (args , & ref )) {
1125
1134
packet_flush (fd [1 ]);
1126
1135
goto all_done ;
1127
1136
}
@@ -1587,7 +1596,10 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
1587
1596
struct strvec index_pack_args = STRVEC_INIT ;
1588
1597
1589
1598
negotiator = & negotiator_alloc ;
1590
- fetch_negotiator_init (r , negotiator );
1599
+ if (args -> refetch )
1600
+ fetch_negotiator_init_noop (negotiator );
1601
+ else
1602
+ fetch_negotiator_init (r , negotiator );
1591
1603
1592
1604
packet_reader_init (& reader , fd [0 ], NULL , 0 ,
1593
1605
PACKET_READ_CHOMP_NEWLINE |
@@ -1613,7 +1625,7 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
1613
1625
/* Filter 'ref' by 'sought' and those that aren't local */
1614
1626
mark_complete_and_common_ref (negotiator , args , & ref );
1615
1627
filter_refs (args , & ref , sought , nr_sought );
1616
- if (everything_local (args , & ref ))
1628
+ if (! args -> refetch && everything_local (args , & ref ))
1617
1629
state = FETCH_DONE ;
1618
1630
else
1619
1631
state = FETCH_SEND_REQUEST ;
0 commit comments