diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2018-08-01 15:18:34 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-08-01 18:07:47 (GMT) |
commit | af3a67de014a145216ef06b588733cd0db002990 (patch) | |
tree | 615ad6e9f1ae22040f57b2e7fba6f0489dad465b /t/t5552-skipping-fetch-negotiator.sh | |
parent | 35e22d54ed3ee237a88c8e7ddeae7f1305011830 (diff) | |
download | git-af3a67de014a145216ef06b588733cd0db002990.zip git-af3a67de014a145216ef06b588733cd0db002990.tar.gz git-af3a67de014a145216ef06b588733cd0db002990.tar.bz2 |
negotiator: unknown fetch.negotiationAlgorithm should error out
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>
Diffstat (limited to 't/t5552-skipping-fetch-negotiator.sh')
-rwxr-xr-x | t/t5552-skipping-fetch-negotiator.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t5552-skipping-fetch-negotiator.sh b/t/t5552-skipping-fetch-negotiator.sh index 0a8e0e4..3b60bd4 100755 --- a/t/t5552-skipping-fetch-negotiator.sh +++ b/t/t5552-skipping-fetch-negotiator.sh @@ -47,6 +47,29 @@ test_expect_success 'commits with no parents are sent regardless of skip distanc have_not_sent c6 c4 c3 ' +test_expect_success 'unknown fetch.negotiationAlgorithm values error out' ' + rm -rf server client trace && + git init server && + test_commit -C server to_fetch && + + git init client && + test_commit -C client on_client && + git -C client checkout on_client && + + test_config -C client fetch.negotiationAlgorithm invalid && + test_must_fail git -C client fetch "$(pwd)/server" 2>err && + test_i18ngrep "unknown fetch negotiation algorithm" err && + + # Explicit "default" value + test_config -C client fetch.negotiationAlgorithm default && + git -C client -c fetch.negotiationAlgorithm=default fetch "$(pwd)/server" && + + # Implementation detail: If there is nothing to fetch, we will not error out + test_config -C client fetch.negotiationAlgorithm invalid && + git -C client fetch "$(pwd)/server" 2>err && + test_i18ngrep ! "unknown fetch negotiation algorithm" err +' + test_expect_success 'when two skips collide, favor the larger one' ' rm -rf server client trace && git init server && |