@@ -55,6 +55,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
5555 struct oid_array shallow = OID_ARRAY_INIT ;
5656 struct string_list deepen_not = STRING_LIST_INIT_DUP ;
5757 struct packet_reader reader ;
58+ enum protocol_version version ;
5859
5960 fetch_if_missing = 0 ;
6061
@@ -219,9 +220,11 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
219220 PACKET_READ_CHOMP_NEWLINE |
220221 PACKET_READ_GENTLE_ON_EOF );
221222
222- switch (discover_version (& reader )) {
223+ version = discover_version (& reader );
224+ switch (version ) {
223225 case protocol_v2 :
224- die ("support for protocol v2 not implemented yet" );
226+ get_remote_refs (fd [1 ], & reader , & ref , 0 , NULL , NULL );
227+ break ;
225228 case protocol_v1 :
226229 case protocol_v0 :
227230 get_remote_heads (& reader , & ref , 0 , NULL , & shallow );
@@ -231,7 +234,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
231234 }
232235
233236 ref = fetch_pack (& args , fd , conn , ref , dest , sought , nr_sought ,
234- & shallow , pack_lockfile_ptr , protocol_v0 );
237+ & shallow , pack_lockfile_ptr , version );
235238 if (pack_lockfile ) {
236239 printf ("lock %s\n" , pack_lockfile );
237240 fflush (stdout );
0 commit comments