Re: [PATCH 12/26] ls-refs: introduce ls-refs server command
- From
- Brandon Williams <bmwill@google.com>
- Date
- Feb 7, 2018, 00:55 UTC
- Message-ID
- <20180207005522.GA222904@google.com>
- In-Reply-To
- <e2fb1a05-3cbd-5226-7796-c5b89c9d3955@jeffhostetler.com>
On 02/01, Jeff Hostetler wrote:
Show 61 quoted lines
>
>
> On 1/2/2018 7:18 PM, Brandon Williams wrote:
> > 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-patterns.
> >
> > Signed-off-by: Brandon Williams <bmwill@google.com>
> > ---
> > Documentation/technical/protocol-v2.txt | 26 +++++++++
> > Makefile | 1 +
> > ls-refs.c | 97 +++++++++++++++++++++++++++++++++
> > ls-refs.h | 9 +++
> > serve.c | 2 +
> > 5 files changed, 135 insertions(+)
> > create mode 100644 ls-refs.c
> > create mode 100644 ls-refs.h
> >
> > diff --git a/Documentation/technical/protocol-v2.txt b/Documentation/technical/protocol-v2.txt
> > index b87ba3816..5f4d0e719 100644
> > --- a/Documentation/technical/protocol-v2.txt
> > +++ b/Documentation/technical/protocol-v2.txt
> > @@ -89,3 +89,29 @@ terminate the connection.
> > Commands are the core actions that a client wants to perform (fetch, push,
> > etc). Each command will be provided with a list capabilities and
> > arguments as requested by a client.
> > +
> > + Ls-refs
> > +---------
> > +
> > +Ls-refs is the command used to request a reference advertisement in v2.
> > +Unlike the current reference advertisement, ls-refs takes in parameters
> > +which can be used to limit the refs sent from the server.
> > +
> > +Ls-ref takes in the following parameters wraped in packet-lines:
> > +
> > + symrefs: In addition to the object pointed by it, show the underlying
> > + ref pointed by it when showing a symbolic ref.
> > + peel: Show peeled tags.
> > + ref-pattern <pattern>: When specified, only references matching the
> > + given patterns are displayed.
> > +
> > +The output of ls-refs is as follows:
> > +
> > + output = *ref
> > + flush-pkt
> > + ref = PKT-LINE((tip | peeled) LF)
> > + tip = obj-id SP refname (SP symref-target)
> > + peeled = obj-id SP refname "^{}"
> > +
> > + symref = PKT-LINE("symref" SP symbolic-ref SP resolved-ref LF)
> > + shallow = PKT-LINE("shallow" SP obj-id LF)
>
> Do you want to talk about ordering requirements on this?
> I think packed-refs has one, but I'm not sure it matters here
> where the client or server sorts it.
>
> Are there any provisions for compressing the renames, like in the
> reftable spec or in index-v4 ?Not currently but it would be rather easy to just add a feature to ls-refs to transmit the resultant list of refs into something like reftable. So this is something that can be added later.
Show 6 quoted lines
> > It doesn't need to be in the initial version. Just asking. We could > always add a "ls-refs-2" command that builds upon this. > > Thanks, > Jeff
-- Brandon Williams