ls-refs: introduce ls-refs server command

Introduce the ls-refs server command.  In protocol v2, the ls-refs
command is used to request the ref advertisement from the server.  Since
it is a command which can be requested (as opposed to mandatory in v1),
a client can sent a number of parameters in its request to limit the ref
advertisement based on provided ref-prefixes.

Signed-off-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Williams
2018-03-15 10:31:20 -07:00
committed by Junio C Hamano
parent ed10cb952d
commit 72d0ea0056
6 changed files with 261 additions and 0 deletions

View File

@ -4,8 +4,15 @@
#include "pkt-line.h"
#include "version.h"
#include "argv-array.h"
#include "ls-refs.h"
#include "serve.h"
static int always_advertise(struct repository *r,
struct strbuf *value)
{
return 1;
}
static int agent_advertise(struct repository *r,
struct strbuf *value)
{
@ -46,6 +53,7 @@ struct protocol_capability {
static struct protocol_capability capabilities[] = {
{ "agent", agent_advertise, NULL },
{ "ls-refs", always_advertise, ls_refs },
};
static void advertise_capabilities(void)