summaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-01-29 13:18:50 -0800
committerJunio C Hamano <gitster@pobox.com>2012-01-29 13:18:50 -0800
commit7b718fbf17f5b51887d420e6edc9dcb7b0c0f83c (patch)
tree4eb9885e931f18d6dfb9c3c6dc5484a0b60d1250 /connect.c
parent7859f533e2247f21cdf3fa74e78b600c9ec62270 (diff)
parentd336572f57e398318a0f6c51cc760d5be9872cc2 (diff)
downloadgit-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.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/connect.c b/connect.c
index 2ea5c3c0fb..912cddeea8 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 {