@@ -591,6 +591,42 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,
return list;
}
+int get_recommended_features(int fd_out, struct packet_reader *reader,
+ struct string_list *list, int stateless_rpc)
+{
+ int line_nr = 1;
+
+ server_supports_v2("features", 1);
+
+ /* (Re-)send capabilities */
+ send_capabilities(fd_out, reader);
+
+ /* Send command */
+ packet_write_fmt(fd_out, "command=features\n");
+ packet_delim(fd_out);
+ packet_flush(fd_out);
+
+ /* Process response from server */
+ while (packet_reader_read(reader) == PACKET_READ_NORMAL) {
+ const char *line = reader->line;
+ line_nr++;
+
+ string_list_append(list, line);
+ }
+
+ if (reader->status != PACKET_READ_FLUSH)
+ return error(_("expected flush after features listing"));
+
+ /*
+ * Might die(), but obscure enough that that's OK, e.g. in
+ * serve.c, we'll call BUG() on its equivalent (the
+ * PACKET_READ_RESPONSE_END check).
+ */
+ check_stateless_delimiter(stateless_rpc, reader,
+ _("expected response end packet after features listing"));
+ return 0;
+}
+
const char *parse_feature_value(const char *feature_list, const char *feature, int *lenp, int *offset)
{
int len;
@@ -242,6 +242,10 @@ int get_remote_bundle_uri(int fd_out, struct packet_reader *reader,
int resolve_remote_symref(struct ref *ref, struct ref *list);
+/* Used for protocol v2 in order to retrieve recommended features */
+int get_recommended_features(int fd_out, struct packet_reader *reader,
+ struct string_list *list, int stateless_rpc);
+
/*
* Remove and free all but the first of any entries in the input list
* that map the same remote reference to the same local reference. If