X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=912cddeea8c4f09ec523ce19e677358c84eda9b7;hb=a12c6b0149e3dadd0701dac4fd0ba2463d251650;hp=2ea5c3c0fbedb89e4189d32a455f289398ce106b;hpb=cc811d8d020682f0d42d5a53c282df1c1a826540;p=git.git diff --git a/connect.c b/connect.c index 2ea5c3c0f..912cddeea 100644 --- a/connect.c +++ b/connect.c @@ -101,8 +101,27 @@ struct ref **get_remote_heads(int in, struct ref **list, int server_supports(const char *feature) { - return server_capabilities && - strstr(server_capabilities, feature) != NULL; + return !!parse_feature_request(server_capabilities, feature); +} + +const char *parse_feature_request(const char *feature_list, const char *feature) +{ + int len; + + if (!feature_list) + return NULL; + + len = strlen(feature); + while (*feature_list) { + const char *found = strstr(feature_list, feature); + if (!found) + return NULL; + if ((feature_list == found || isspace(found[-1])) && + (!found[len] || isspace(found[len]) || found[len] == '=')) + return found; + feature_list = found + 1; + } + return NULL; } enum protocol {