pr-infos = pr-info | pr-infos ";" pr-info pr-info = "name=" pr-name | "name=" pr-name "," "url=" pr-url pr-info = pr-info | pr-info "," fld-name "=" fld-value [snip] > diff --git a/promisor-remote.c b/promisor-remote.c > index 24d0e70132..70abec4c24 100644 > --- a/promisor-remote.c > +++ b/promisor-remote.c > @@ -314,6 +314,84 @@ static int allow_unsanitized(char ch) > return ch > 32 && ch < 127; > } > > +/* > + * List of field names allowed to be used in the "promisor-remote" > + * protocol capability. Each field should correspond to a configurable > + * property of a remote that can be relevant for the client. > + */ > +static const char *allowed_fields[] = { > + "partialCloneFilter", /* Filter used for partial clone */ > + "token", /* Authentication token for the remote */ > + NULL > +}; > + > +/* > + * Check if 'field' is in the list of allowed field names for the > + * "promisor-remote" protocol capability. > + */ > +static int is_allowed_field(const char *field) > +{ > + const char **p; > + > + for (p = allowed_fields; *p; p++) > + if (!strcasecmp(*p, field)) > + return 1; > + return 0; > +} > + > +static int valid_field(struct string_list_item *item, void *cb_data) > +{ Nit: Shouldn't this be `is_valid_field` similar to `is_allowed_field`? > + const char *field = item->string; > + const char *config_key = (const char *)cb_data; > + > + if (!is_allowed_field(field)) { Nit: Can't we just inline this? > + warning(_("unsupported field '%s' in '%s' config"), field, config_key); > + return 0; > + } > + return 1; > +} > + > +static char *fields_from_config(struct string_list *fields_list, const char *config_key) > +{ > + char *fields = NULL; > + > + if (!git_config_get_string(config_key, &fields) && *fields) { > + string_list_split_in_place(fields_list, fields, ", ", -1); > + filter_string_list(fields_list, 0, valid_field, (void *)config_key); > + } > + > + return fields; > +} > + > +static struct string_list *fields_sent(void) > +{ > + static struct string_list fields_list = STRING_LIST_INIT_NODUP; > + static int initialized = 0; > + > + if (!initialized) { > + fields_list.cmp = strcasecmp; > + fields_from_config(&fields_list, "promisor.sendFields"); Nit: Here too, can't this be inlined? While the modularity is nice, I'm not sure the redirection is warranted for such small functions with very specific usecases. [snip] Apart from the nits, the patch looks good :) --000000000000eee20406348b19f4 Content-Type: application/pgp-signature; name="signature.asc" Content-Disposition: attachment; filename="signature.asc" Content-Transfer-Encoding: base64 X-Attachment-Id: 8498e072a379ef03_0.1 LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSEtCQUVCQ2dBMEZpRUVWODVNZjJOMWNR L0xaY1lHUHRXZkpJNUdqSDhGQW1nYlZja1dIR3RoY25Sb2FXc3UKTVRnNFFHZHRZV2xzTG1OdmJR QUtDUkErMVo4a2prYU1mK1RRREFDR3BZRU9NSjkrOXdCanNJclhZMWU0dS92MwpXd0JPM2F5bUZ3 RXF6UDZ1VFo5ODgxRDhROWhjTkthSCt4RlRNKzFRQlByOHRwVEQ2VEhzR3ZYYm1SRW1CVk1MClZE bjRwYzdNMTNCdzBKOUNPa1hwMWxHRm9OVS9YQWlnYUY0Rlc1Mk1RaGxuTUl6S1ZVZWNXSThGWGgy YmJObVgKTU5DRFU5U1oxVkdIcGFTYUZKUEJKbEhpaUdLeVd2SVFxY0lVbEhUb09IMXJnSWNRUXVF TnVzZzFUTGZ4Q2d2cwpMWEF1S0NjZEdjV2dtTVFDcG5BV1gxS3pSdGZ5WWpVekd4VFRpUVlUTzZ0 UjV0QWVzVHZwcFk0RXhVanJLSkR3CnFDZ3BmWGJnL2lvWTBSU3R1dk5aWEtTVkJJS2RDc3VMQnFR U3U3LzFVajd1ZnFxWWMyYmd1Z3VSR0x6WUc5dWQKamROWXBFZkJqSm1vRzlYbG9tR2d5VktGOGRL OU1xYTlFNFZxUHBxRnBJc1IweTgxNThlMEhsV0ZscGxGSUNRUwp5ZUNlY253SnJDRFBGQTgrYnNj QjJ4d0VxQWJ4cHUwS3l2SjJYSmVISXorNlJISi9Sd2kyaTdUYlQzTDZyVVh0CloyR1JGU3VOU0hN WHJCbUNXUWxUL1ZTV25nc1oyRGE0cTJmV3dDbz0KPXd5MVMKLS0tLS1FTkQgUEdQIFNJR05BVFVS RS0tLS0t --000000000000eee20406348b19f4--