mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
af3a67de01
Change the handling of fetch.negotiationAlgorithm=<str> 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 <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
21 lines
545 B
C
21 lines
545 B
C
#include "git-compat-util.h"
|
|
#include "fetch-negotiator.h"
|
|
#include "negotiator/default.h"
|
|
#include "negotiator/skipping.h"
|
|
|
|
void fetch_negotiator_init(struct fetch_negotiator *negotiator,
|
|
const char *algorithm)
|
|
{
|
|
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);
|
|
}
|