@@ -15,6 +15,7 @@ static int transfer_unpack_limit = -1;
1515static int fetch_unpack_limit = -1 ;
1616static int unpack_limit = 100 ;
1717static int prefer_ofs_delta = 1 ;
18+ static int no_done = 0 ;
1819static struct fetch_pack_args args = {
1920 /* .uploadpack = */ "git-upload-pack" ,
2021};
@@ -236,6 +237,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
236237 const unsigned char * sha1 ;
237238 unsigned in_vain = 0 ;
238239 int got_continue = 0 ;
240+ int got_ready = 0 ;
239241 struct strbuf req_buf = STRBUF_INIT ;
240242 size_t state_len = 0 ;
241243
@@ -274,6 +276,7 @@ static int find_common(int fd[2], unsigned char *result_sha1,
274276 struct strbuf c = STRBUF_INIT ;
275277 if (multi_ack == 2 ) strbuf_addstr (& c , " multi_ack_detailed" );
276278 if (multi_ack == 1 ) strbuf_addstr (& c , " multi_ack" );
279+ if (no_done ) strbuf_addstr (& c , " no-done" );
277280 if (use_sideband == 2 ) strbuf_addstr (& c , " side-band-64k" );
278281 if (use_sideband == 1 ) strbuf_addstr (& c , " side-band" );
279282 if (args .use_thin_pack ) strbuf_addstr (& c , " thin-pack" );
@@ -391,6 +394,10 @@ static int find_common(int fd[2], unsigned char *result_sha1,
391394 retval = 0 ;
392395 in_vain = 0 ;
393396 got_continue = 1 ;
397+ if (ack == ACK_ready ) {
398+ rev_list = NULL ;
399+ got_ready = 1 ;
400+ }
394401 break ;
395402 }
396403 }
@@ -404,8 +411,10 @@ static int find_common(int fd[2], unsigned char *result_sha1,
404411 }
405412 }
406413done :
407- packet_buf_write (& req_buf , "done\n" );
408- send_request (fd [1 ], & req_buf );
414+ if (!got_ready || !no_done ) {
415+ packet_buf_write (& req_buf , "done\n" );
416+ send_request (fd [1 ], & req_buf );
417+ }
409418 if (args .verbose )
410419 fprintf (stderr , "done\n" );
411420 if (retval != 0 ) {
@@ -708,6 +717,11 @@ static struct ref *do_fetch_pack(int fd[2],
708717 if (args .verbose )
709718 fprintf (stderr , "Server supports multi_ack_detailed\n" );
710719 multi_ack = 2 ;
720+ if (server_supports ("no-done" )) {
721+ if (args .verbose )
722+ fprintf (stderr , "Server supports no-done\n" );
723+ no_done = 1 ;
724+ }
711725 }
712726 else if (server_supports ("multi_ack" )) {
713727 if (args .verbose )
0 commit comments