@@ -29,6 +29,7 @@ static int deepen_not_ok;
2929static int fetch_fsck_objects = -1 ;
3030static int transfer_fsck_objects = -1 ;
3131static int agent_supported ;
32+ static int server_supports_filtering ;
3233static struct lock_file shallow_lock ;
3334static const char * alternate_shallow_file ;
3435
@@ -379,6 +380,8 @@ static int find_common(struct fetch_pack_args *args,
379380 if (deepen_not_ok ) strbuf_addstr (& c , " deepen-not" );
380381 if (agent_supported ) strbuf_addf (& c , " agent=%s" ,
381382 git_user_agent_sanitized ());
383+ if (args -> filter_options .choice )
384+ strbuf_addstr (& c , " filter" );
382385 packet_buf_write (& req_buf , "want %s%s\n" , remote_hex , c .buf );
383386 strbuf_release (& c );
384387 } else
@@ -407,6 +410,9 @@ static int find_common(struct fetch_pack_args *args,
407410 packet_buf_write (& req_buf , "deepen-not %s" , s -> string );
408411 }
409412 }
413+ if (server_supports_filtering && args -> filter_options .choice )
414+ packet_buf_write (& req_buf , "filter %s" ,
415+ args -> filter_options .filter_spec );
410416 packet_buf_flush (& req_buf );
411417 state_len = req_buf .len ;
412418
@@ -969,6 +975,13 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
969975 else
970976 prefer_ofs_delta = 0 ;
971977
978+ if (server_supports ("filter" )) {
979+ server_supports_filtering = 1 ;
980+ print_verbose (args , _ ("Server supports filter" ));
981+ } else if (args -> filter_options .choice ) {
982+ warning ("filtering not recognized by server, ignoring" );
983+ }
984+
972985 if ((agent_feature = server_feature_value ("agent" , & agent_len ))) {
973986 agent_supported = 1 ;
974987 if (agent_len )
0 commit comments