From af3a67de014a145216ef06b588733cd0db002990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Wed, 1 Aug 2018 15:18:34 +0000 Subject: negotiator: unknown fetch.negotiationAlgorithm should error out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the handling of fetch.negotiationAlgorithm= to error out on unknown strings, i.e. everything except "default" or "skipping". This changes the behavior added in 42cc7485a2 ("negotiator/skipping: skip commits during fetch", 2018-07-16) which would ignore all unknown values and silently fall back to the "default" value. For a feature like this it's much better to produce an error than proceed. We don't want users to debug some amazingly slow fetch that should benefit from "skipping", only to find that they'd forgotten to deploy the new git version on that particular machine. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- fetch-negotiator.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'fetch-negotiator.c') diff --git a/fetch-negotiator.c b/fetch-negotiator.c index 5d283049f4..d6d685cba0 100644 --- a/fetch-negotiator.c +++ b/fetch-negotiator.c @@ -6,9 +6,15 @@ void fetch_negotiator_init(struct fetch_negotiator *negotiator, const char *algorithm) { - if (algorithm && !strcmp(algorithm, "skipping")) { - skipping_negotiator_init(negotiator); - return; + if (algorithm) { + if (!strcmp(algorithm, "skipping")) { + skipping_negotiator_init(negotiator); + return; + } else if (!strcmp(algorithm, "default")) { + /* Fall through to default initialization */ + } else { + die("unknown fetch negotiation algorithm '%s'", algorithm); + } } default_negotiator_init(negotiator); } -- cgit v1.2.3