upload-pack: propagate return value from object filter config callback

If we encounter an error in parse_filter_object_config(), we'll complain to stderr but won't actually propagate the return value up the stack. This is unlike most of our config callbacks, which return the error to git_config() so it can die (this includes the call just below us to parse_hide_refs_config(), which can also produce errors). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 3, 2020 at 03:09 UTC d43a21bdbbaf0bc286df8d8e2e29a3e9caa448e8
2 files changed +10 -1
t/t5616-partial-clone.sh
+8
@@ -251,6 +251,14 @@ test_expect_success 'implicitly construct combine: filter with repeated flags' '
251 test_cmp unique_types.expected unique_types.actual
252 '
253
254 +test_expect_success 'upload-pack complains of bogus filter config' '
255 + printf 0000 |
256 + test_must_fail git \
257 + -c uploadpackfilter.tree.maxdepth \
258 + upload-pack . >/dev/null 2>err &&
259 + test_i18ngrep "unable to parse.*tree.maxdepth" err
260 +'
261 +
262 test_expect_success 'upload-pack fails banned object filters' '
263 test_config -C srv.bare uploadpackfilter.blob:none.allow false &&
264 test_must_fail ok=sigpipe git clone --no-checkout --filter=blob:none \
upload-pack.c
+2 -1
@@ -1307,7 +1307,8 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
1307 return git_config_string(&data->pack_objects_hook, var, value);
1308 }
1309
1310 - parse_object_filter_config(var, value, data);
1310 + if (parse_object_filter_config(var, value, data) < 0)
1311 + return -1;
1312
1313 return parse_hide_refs_config(var, value, "uploadpack");
1314 }