As in the pack protocol version 2 we want to negotiate the capabilities before any other exchange we will have a function which will take care of the whole negotiation process. It will be placed in fetch-pack.c for now as there we have access to its internal variables and we'll work on a `struct fetch_pack_args`. Eventually we want to move it to a better place such as transport.c Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx> --- fetch-pack.c | 14 ++++++++++++++ fetch-pack.h | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/fetch-pack.c b/fetch-pack.c index b43490f..1544629 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -888,6 +888,20 @@ static void get_selected_capabilities_list(struct string_list *list, } } +void negotiate_capabilities(int fd[2], struct fetch_pack_args *args) +{ + struct string_list list = STRING_LIST_INIT_NODUP; + + get_remote_capabilities(fd[0], NULL, 0); + + select_capabilities(args); + get_selected_capabilities_list(&list, args); + + request_capabilities(fd[1], &list); + + string_list_clear(&list, 1); +} + static struct ref *do_fetch_pack(struct fetch_pack_args *args, int fd[2], const struct ref *orig_ref, diff --git a/fetch-pack.h b/fetch-pack.h index 3314362..198498a 100644 --- a/fetch-pack.h +++ b/fetch-pack.h @@ -29,6 +29,12 @@ struct fetch_pack_args { }; /* + * In version 2 of the pack protocol we negotiate the capabilities + * before the actual transfer of refs and packs. + */ +void negotiate_capabilities(int fd[2], struct fetch_pack_args *args); + +/* * sought represents remote references that should be updated from. * On return, the names that were found on the remote will have been * marked as such. -- 2.8.0.32.g71f8beb.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html