]> git.ipfire.org Git - thirdparty/git.git/commit - serve.c
serve: return capability "value" from get_capability()
authorJeff King <peff@peff.net>
Tue, 14 Sep 2021 15:30:50 +0000 (11:30 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Sep 2021 17:56:19 +0000 (10:56 -0700)
commit5ef260d2d124c0fcd799bd4aaf6fa1793a6c74de
tree6a908fa2f124cba2b08b4a3f593f13607544397b
parent76804526f9795f94fb666248653a5f41ed921241
serve: return capability "value" from get_capability()

When the client sends v2 capabilities, they may be simple, like:

  foo

or have a value like:

  foo=bar

(all of the current capabilities actually expect a value, but the
protocol allows for boolean ones).

We use get_capability() to make sure the client's pktline matches a
capability. In doing so, we parse enough to see the "=" and the value
(if any), but we immediately forget it. Nobody cares for now, because they end
up parsing the values out later using has_capability(). But in
preparation for changing that, let's pass back a pointer so the callers
know what we found.

Note that unlike has_capability(), we'll return NULL for a "simple"
capability. Distinguishing these will be useful for some future patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
serve.c