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@xxxxxxxxxx> --- 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 ? 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