Skip to content

Commit a9a136c

Browse files
newrengitster
authored andcommitted
repo-settings: fix error handling for unknown values
In commit af3a67d ("negotiator: unknown fetch.negotiationAlgorithm should error out", 2018-08-01), error handling for an unknown fetch.negotiationAlgorithm was added with the code die()ing. This was also added to the documentation for the fetch.negotiationAlgorithm option, to make it explicit that the code would die on unknown values. This behavior was lost with commit aaf633c ("repo-settings: create feature.experimental setting", 2019-08-13). Restore it so that the behavior again matches the documentation. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a68c5b9 commit a9a136c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

repo-settings.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ void prepare_repo_settings(struct repository *r)
8484
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_NOOP;
8585
else if (!strcasecmp(strval, "default"))
8686
r->settings.fetch_negotiation_algorithm = FETCH_NEGOTIATION_DEFAULT;
87+
else
88+
die("unknown fetch negotiation algorithm '%s'", strval);
8789
}
8890

8991
/*

t/t5500-fetch-pack.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,13 @@ test_expect_success 'same as last but with config overrides' '
971971
-c fetch.negotiationAlgorithm=default
972972
'
973973

974+
test_expect_success 'ensure bogus fetch.negotiationAlgorithm yields error' '
975+
test_when_finished rm -rf clientv0 &&
976+
cp -r client clientv0 &&
977+
test_must_fail git -C clientv0 --fetch.negotiationAlgorithm=bogus \
978+
fetch origin server_has both_have_2
979+
'
980+
974981
test_expect_success 'filtering by size' '
975982
rm -rf server client &&
976983
test_create_repo server &&

0 commit comments

Comments
 (0)