fetch-pack: introduce negotiator API

Introduce the new files fetch-negotiator.{h,c}, which contains an API
behind which the details of negotiation are abstracted. Currently, only
one algorithm is available: the existing one.

This patch is written to be easily reviewed: static functions are
moved verbatim from fetch-pack.c to negotiator/default.c, and it can be
seen that the lines replaced by negotiator->X() calls are present in the
X() functions respectively.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jonathan Tan
2018-06-14 15:54:28 -07:00
committed by Junio C Hamano
parent d093bc7582
commit ec06283844
7 changed files with 292 additions and 167 deletions

8
fetch-negotiator.c Normal file
View File

@ -0,0 +1,8 @@
#include "git-compat-util.h"
#include "fetch-negotiator.h"
#include "negotiator/default.h"
void fetch_negotiator_init(struct fetch_negotiator *negotiator)
{
default_negotiator_init(negotiator);
}