serve: add "receive" method for v2 capabilities table
commite56e53067fc3d31899e837293a5bf72e2d086b4a
authorJeff King <peff@peff.net>
Tue, 14 Sep 2021 15:31:07 +0000 (14 11:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 14 Sep 2021 17:56:19 +0000 (14 10:56 -0700)
tree47e7c9638d08ddc3d2bf81cbe6b172c8fbe08ffc
parent5ef260d2d124c0fcd799bd4aaf6fa1793a6c74de
serve: add "receive" method for v2 capabilities table

We have a capabilities table that tells us what we should tell the
client we are capable of, and what to do when a client gives us a
particular command (e.g., "command=ls-refs"). But it doesn't tell us
what to do when the client sends us back a capability (e.g.,
"object-format=sha256"). We just collect them all in a strvec and hope
somebody can use them later.

Instead, let's provide a function pointer in the table to act on these.
This will eventually help us avoid collecting the strings, which will be
more efficient and less prone to mischief.

Using the new method is optional, which helps in two ways:

  - we can move existing capabilities over to this new system gradually
    in individual commits

  - some capabilities we don't actually do anything with anyway. For
    example, the client is free to say "agent=git/1.2.3" to us, but we
    do not act on the information in any way.

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