diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:50 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-29 13:18:50 -0800 |
commit | 7b718fbf17f5b51887d420e6edc9dcb7b0c0f83c (patch) | |
tree | 4eb9885e931f18d6dfb9c3c6dc5484a0b60d1250 /connect.c | |
parent | 7859f533e2247f21cdf3fa74e78b600c9ec62270 (diff) | |
parent | d336572f57e398318a0f6c51cc760d5be9872cc2 (diff) | |
download | git-7b718fbf17f5b51887d420e6edc9dcb7b0c0f83c.tar.gz |
Merge branch 'cb/push-quiet'
* cb/push-quiet:
t5541: avoid TAP test miscounting
fix push --quiet: add 'quiet' capability to receive-pack
server_supports(): parse feature list more carefully
Diffstat (limited to 'connect.c')
-rw-r--r-- | connect.c | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -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 { |